From: Evan You Date: Tue, 28 Mar 2023 09:29:31 +0000 (+0800) Subject: feat(compiler-sfc): improve runtime props inference for enum X-Git-Tag: v3.3.0-alpha.6~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eded94712e37856f258dc8c85f98a26fa41ae05f;p=thirdparty%2Fvuejs%2Fcore.git feat(compiler-sfc): improve runtime props inference for enum --- diff --git a/packages/compiler-sfc/__tests__/compileScript.spec.ts b/packages/compiler-sfc/__tests__/compileScript.spec.ts index f375f51ac0..a83029a252 100644 --- a/packages/compiler-sfc/__tests__/compileScript.spec.ts +++ b/packages/compiler-sfc/__tests__/compileScript.spec.ts @@ -1573,6 +1573,56 @@ const emit = defineEmits(['a', 'b']) }) }) + test('runtime inference for Enum in defineProps', () => { + expect( + compile( + ``, + { hoistStatic: true } + ).content + ).toMatch(`foo: { type: Number`) + + expect( + compile( + ``, + { hoistStatic: true } + ).content + ).toMatch(`foo: { type: String`) + + expect( + compile( + ``, + { hoistStatic: true } + ).content + ).toMatch(`foo: { type: [String, Number]`) + + expect( + compile( + ``, + { hoistStatic: true } + ).content + ).toMatch(`foo: { type: Number`) + }) + test('import type', () => { const { content } = compile( `