From eab76046e3b1779dd7a856b6b974e928075d6a1e Mon Sep 17 00:00:00 2001 From: ygj6 <7699524+ygj6@users.noreply.github.com> Date: Wed, 26 Oct 2022 17:12:55 +0800 Subject: [PATCH] fix(compiler-sfc): allow type annotation for defineEmits variable (#5394) fix #5393 --- .../__snapshots__/compileScript.spec.ts.snap | 17 +++++++++++++++++ .../__tests__/compileScript.spec.ts | 13 +++++++++++++ packages/compiler-sfc/src/compileScript.ts | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index aa5e2d04926..737cc90174e 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -1309,6 +1309,23 @@ export default /*#__PURE__*/_defineComponent({ +return { emit } +} + +})" +`; + +exports[`SFC compile + `) + assertCode(content) + expect(content).toMatch(`setup(__props, { expose, emit }) {`) + expect(content).toMatch(`emits: ['foo']`) + }) + test('runtime Enum', () => { const { content, bindings } = compile( `