Skip to content

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

@tragid

Description

@tragid

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions