Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue 3.3.4. defineEmits doesn't setup extended events #8465

Closed
tragid opened this issue May 31, 2023 · 1 comment · Fixed by #8470
Closed

Vue 3.3.4. defineEmits doesn't setup extended events #8465

tragid opened this issue May 31, 2023 · 1 comment · Fixed by #8470
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. scope: compiler scope: script-setup

Comments

@tragid
Copy link

tragid commented May 31, 2023

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

  1. Create BaseEmits type:
export interface BaseEmits {
  (e: 'input-event', value: string): void;
  (e: 'change-event', value: string): void;
}
  1. 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();

  1. 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

@so1ve
Copy link
Member

so1ve commented Nov 7, 2023

Before the fix gets merged, you can use https://github.com/unplugin/unplugin-vue-complex-types as a temporal solution.

@yyx990803 yyx990803 added the ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. label Nov 9, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Nov 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. scope: compiler scope: script-setup
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants