I am struggling to correctly type the parent event handler based on the child definition, but no matter what I try, I always end up with `any` as the event type.
Here is a code example:
<script setup lang="ts">
// Child component
type EventPayload = {
foo: boolean
}
const emits = defineEmits<{
'my-event': [EventPayload]
}>()
const onClick = () => {
emits('my-event', { foo: true})
}
</script>
<template>
<button @click="onClick" />
</template>
<script setup lang="ts">
// Parent component
const onMyEvent = ({ foo }) => { // type error Binding element 'foo' implicitly has an 'any' type.
console.log(foo)
}
</script>
<template>
<child @my-event="onMyEvent" />
<template>