mirror of https://github.com/vuejs/core.git
parent
660132df6c
commit
1022eabaa1
|
@ -306,6 +306,14 @@ describe('defineEmits w/ type declaration', () => {
|
||||||
emit2('baz')
|
emit2('baz')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('defineEmits w/ interface declaration', () => {
|
||||||
|
interface Emits {
|
||||||
|
foo: [value: string]
|
||||||
|
}
|
||||||
|
const emit = defineEmits<Emits>()
|
||||||
|
emit('foo', 'hi')
|
||||||
|
})
|
||||||
|
|
||||||
describe('defineEmits w/ alt type declaration', () => {
|
describe('defineEmits w/ alt type declaration', () => {
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
foo: [id: string]
|
foo: [id: string]
|
||||||
|
|
|
@ -149,9 +149,7 @@ export function defineEmits() {
|
||||||
return null as any
|
return null as any
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ComponentTypeEmits =
|
export type ComponentTypeEmits = ((...args: any[]) => any) | Record<string, any>
|
||||||
| ((...args: any[]) => any)
|
|
||||||
| Record<string, any[]>
|
|
||||||
|
|
||||||
type RecordToUnion<T extends Record<string, any>> = T[keyof T]
|
type RecordToUnion<T extends Record<string, any>> = T[keyof T]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue