Description
What rule do you want to change?
vue/define-emits-declaration
Does this change cause the rule to produce more or fewer warnings?
It's just a stylistic rule for enforcing the more ergonomic defineEmits
types introduced in Vue v3.3.
How will the change be implemented? (New option, new default behavior, etc.)?
Could be a new option type-literal
alongside type-based
or could be a configuration option when using type-based
. One could also think about enforcing the usage of labeled tuple elements as shown in the example docs.
Please provide some example code that this change will affect:
// Valid with `type-literal`
const emit = defineEmits<{
foo: [id: number]
bar: [name: string, ...rest: any[]]
}>()
// Invalid with `type-literal`
const emit = defineEmits<{
(e: 'foo', id: number): void
(e: 'bar', name: string, ...rest: any[]): void
}>()
What does the rule currently do for this code?
Enforce either type-based or runtime based defineEmits
declaration.
What will the rule do after it's changed?
Add also an option to enforce the new type syntax for defineEmits
introduced in v3.3.
Additional context