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', () => {
const emit = defineEmits<{
foo: [id: string]
return null as any
}
-export type ComponentTypeEmits =
- | ((...args: any[]) => any)
- | Record<string, any[]>
+export type ComponentTypeEmits = ((...args: any[]) => any) | Record<string, any>
type RecordToUnion<T extends Record<string, any>> = T[keyof T]