Skip to content

Vue 3.3.4. doesn't setup events defined with enum values #8466

Open
@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-2

Steps to reproduce

  1. Create enum:
export enum InputType {
  INPUT = 'input-event',
  CHANGE = 'change-event',
  BLUR = 'blur-event',
  FOCUS = 'focus-event',
}
  1. Create component with defineEmits:
interface ComponentEmits {
  (e: 'click-event', value: string): void;
  (e: InputType.BLUR, value: string): void;
  (e: InputType.FOCUS, value: string): void;
  (e: InputType.INPUT, value: string): void;
  (e: InputType.CHANGE, value: string): void;
}

const emit = defineEmits<ComponentEmits>();
  1. Facing runtime errors on DEV and not setting up emits on PROD.
runtime-core.esm-bundler.js:41 [Vue warn]: Component emitted event "focus-event" but it is neither declared in the emits option nor as an "onFocus-event" prop.

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.

runtime-core.esm-bundler.js:41 [Vue warn]: Component emitted event "blur-event" but it is neither declared in the emits option nor as an "onBlur-event" prop.

What is expected?

Can setup events with imported enum

What is actually happening?

Facing runtime errors on DEV and not setting up emits on PROD.

runtime-core.esm-bundler.js:41 [Vue warn]: Component emitted event "focus-event" but it is neither declared in the emits option nor as an "onFocus-event" prop.

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.

runtime-core.esm-bundler.js:41 [Vue warn]: Component emitted event "blur-event" but it is neither declared in the emits option nor as an "onBlur-event" prop.

System Info

No response

Any additional comments?

No response

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