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

@@ -692,7 +692,7 @@ return { a, b, c, d, x }
}"
`;
exports[`SFC compile <script setup> with TypeScript defineEmit w/ type (union) 1`] = `
exports[`SFC compile <script setup> with TypeScript defineEmit w/ type (type literal w/ call signatures) 1`] = `
"import { defineComponent as _defineComponent } from 'vue'
@@ -700,7 +700,7 @@ export default _defineComponent({
expose: [],
emits: [\\"foo\\", \\"bar\\", \\"baz\\"] as unknown as undefined,
setup(__props, { emit }: {
emit: (((e: 'foo' | 'bar') => void) | ((e: 'baz', id: number) => void)),
emit: ({(e: 'foo' | 'bar'): void; (e: 'baz', id: number): void;}),
slots: any,
attrs: any
}) {