Skip to content

Can't use own type in defineEmits in new Vue 3.3 structure #3223

Closed as not planned
@szulcus

Description

@szulcus

Work:

const emit = defineEmits<{
	close: [];
}>();

Don't work:

interface Emits {
	close: [];
}
const emit = defineEmits<Emits>();
Type 'Emits' does not satisfy the constraint '((...args: any[]) => any) | Record<string, any[]>'.
  Type 'Emits' is not assignable to type 'Record<string, any[]>'.ts(2344)

image
Previous structure works fine:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions