Skip to content

defineEmits with typescript and union types raises a warning #7943

@elfjes

Description

@elfjes

Vue version

3.2.47

Link to minimal reproduction

https://sfc.vuejs.org/#eNpNUMtuwkAM/BXLF0CC5J4uqD30L3wJwcDS7ENrh6qi/Hu9SaX2tPbszHg0D3zLublPjB065ZDHXvlAEcAdJ9UU4XUY/fCxJ+Tgdb2SFHi1ITzMMAR27UI0kWv/OTgZis8KwjplGPt4MQ8VU1LUr8zwbn4CeyCsnoTwbWM9QvhCcUhRFOpqlBOffeRZ4B413Jq7Rb/p4J78yQQLSNjHpFcuhFu492MHosXHyx/veVhv7HHtks/S4BZ9yKnoLvS5uUmKVsZ8hn4/LHUHM1Ixa6vuhFfVLF3bynmoFd6kSeXS2tSUKaoP3LCE3bGkT+FixoTV4mkZ8PkDyDyALQ==

Steps to reproduce

click the button that says click me

What is expected?

some event is emitted without warning

What is actually happening?

A warning is raised Component emitted event "some" but it is neither declared in the emits option nor as an "onSome" prop.

System Info

No response

Any additional comments?

The warning is only raised due to the presence of another defined event. If the another event is not defined, the some event is registered properly. ie the following works properly:

type Emits = "some" | "emit"; const emit = defineEmits<{ (e: Emits): void; }>(); 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions