Vue 3.3.4. defineEmits doesn't setup extended events
Vue version
3.3.4
Link to minimal reproduction
https://github.com/tragid/vue-default-export-error/tree/vue-3.3.4-emit-errors
Steps to reproduce
- Create BaseEmits type:
export interface BaseEmits {
(e: 'input-event', value: string): void;
(e: 'change-event', value: string): void;
}
- Create component and defineEmits with extending BaseEmits interface ComponentEmits extends BaseEmits { (e: 'blur-event', value: string): void; (e: 'focus-event', value: string): void; }
const emit = defineEmits
- Facing runtime exceptions on DEV and not setup extended emits on prod:
runtime-core.esm-bundler.js:41 [Vue warn]: Component emitted event "input-event" but it is neither declared in the emits option nor as an "onInput-event" prop.
runtime-core.esm-bundler.js:41 [Vue warn]: Component emitted event "change-event" but it is neither declared in the emits option nor as an "onChange-event" prop.
What is expected?
defineEmits can support extended events
What is actually happening?
Facing runtime exceptions on DEV and not setup extended emits on prod:
runtime-core.esm-bundler.js:41 [Vue warn]: Component emitted event "input-event" but it is neither declared in the emits option nor as an "onInput-event" prop.
runtime-core.esm-bundler.js:41 [Vue warn]: Component emitted event "change-event" but it is neither declared in the emits option nor as an "onChange-event" prop.
System Info
No response
Any additional comments?
No response
Before the fix gets merged, you can use https://github.com/unplugin/unplugin-vue-complex-types as a temporal solution.