I'm using Vue 3.3+ syntax for defining my emits:
const emit = defineEmits<{
ItemClicked: [args: { url: string | undefined, index: number }]
}>()
But when I try to attach a handler function to this emit:
<my-component @ItemClicked="showItem" />
const showItem = (args: { url: string | undefined, index: number }) => {
//...
}
Typescript keeps show the following error:
Type '(args: { url: string | undefined; index: number;}) => void' is not assignable to type '($event?: undefined) => any'.
Types of parameters 'args' and '$event' are incompatible.ts(2322)
My Vue version is 3.4.21 and Typescript is 5.4.2.