-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Description
Vue version
v3.4.37
Link to minimal reproduction
Steps to reproduce
Open the console and click on one of the two buttons. Check the console logs.
What is expected?
The lower button is functioning as expected. We observe two console logs: one from the child component before it emits the event, and another from the parent component after it catches the event and responds accordingly.
What is actually happening?
The upper button is not working. We can see the console log from the child component, but the event is not being processed by the parent.
System Info
No response
Any additional comments?
We have already identified that the issue is related to typing the parameter again in the event handler. According to the TypeScript with Composition API guide, it is recommended to type the parameter in defineEmit and in the event handling function. However, it feels wrong that explicitly typing the parameter causes it to break, while typing it as any
works. Why does explicitly typing the parameter break event handling?