Skip to content

Union typed array events do not trigger event handlers #11615

@marc-rosenau

Description

@marc-rosenau

Vue version

v3.4.37

Link to minimal reproduction

https://play.vuejs.org/#__SSR__eNqtVE1v00AQ/SujvdiWWodQJCTjRAWUAxwAAeJSV8ixJ8429q61H/lQyH9ndh2nSRuChLh5Z2ffvPdmxlv2tm3jpUWWsFQXircGNBrbQp2LapQxozM2zgRvWqkMbEHhDHYwU7KBgJ4Fh6tJw817Sd8ChdknxIOTqKsTvMlEOugqES4dDDZtnRukE0Cq21yMH3GGIKSBlVQLLiooLYKRYDYtnRKCccn+2Wn122VeW7wu5qQBS1IRClz9cDGdQChsM0UFv0AbRTjR3X0EozFsHRBAIYWWNca1rMKgVbJArV1tpAoGS/DQQeSSd94aqn4qs4tN1VlBL4Hrg54VN3PIxQakIp29LsL7J2EE9N+FpIOj9tBRm03ddcpR7Eu1eVkS9LXi1dwkMHzRrjtY1+r9C3ZFs0ScZryKH7QUNHD+dcYKqsdrVJ9bw4lzxpIeN2N5XcvVRx8zyuJVHy/mWCzOxB/02sUy9kWhRrXEjB3uTK4qNN315NsnXNP34bKRpa0p+8LlVyQ/rePYpb2zoiTaR3me7Qe/D2THdz1ZGxS6F+WIelt8fsZoG5zVf5L+SPcmfrW3c0cuPlupv6zuheWlXcyEmxMDhVWK8PwswchlpuG5TRmHd8N7Gpr+nZsmyi9xxgU6ajr1CsJOhsgbTKjY8dgGe7/2R18y6UL07nlNnx4lsJS8JMa7cRh54jMrCmeb5+BRwqiz72T0/by7wT8aeBcLn7I68SD2l5RMrl/+Y02tMUTitqh5sSDbD2zIfWcIdPuZDrrEp0tFHf25ROWmhBpJrY5vXrPdbypE6KE=

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.scope: compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions