From: ygj6 <7699524+ygj6@users.noreply.github.com>
Date: Wed, 26 Oct 2022 09:12:55 +0000 (+0800)
Subject: fix(compiler-sfc): allow type annotation for defineEmits variable (#5394)
X-Git-Tag: v3.2.42~48
X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eab76046e3b1779dd7a856b6b974e928075d6a1e;p=thirdparty%2Fvuejs%2Fcore.git
fix(compiler-sfc): allow type annotation for defineEmits variable (#5394)
fix #5393
---
diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap
index aa5e2d0492..737cc90174 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(
`