fix(compiler-sfc): support proper type arguments for defineEmit helper

fix #2874
This commit is contained in:
Evan You
2021-03-29 16:38:07 -04:00
parent 2793bc0918
commit bb8cdcad9f
4 changed files with 40 additions and 14 deletions

View File

@@ -56,6 +56,15 @@ describe('defineEmit w/ type declaration', () => {
emit()
// @ts-expect-error
emit('bar')
type Emits = { (e: 'foo' | 'bar'): void; (e: 'baz', id: number): void }
const emit2 = defineEmit<Emits>()
emit2('foo')
emit2('bar')
emit2('baz', 123)
// @ts-expect-error
emit2('baz')
})
describe('defineEmit w/ runtime declaration', () => {