From 14d65181f1610079f0d9969c214720624056106b Mon Sep 17 00:00:00 2001 From: edison Date: Mon, 6 Sep 2021 06:10:15 +0800 Subject: [PATCH] fix(compiler-sfc): support using declared interface in normal script with defineProps() (#4522) fix #4423 --- .../__snapshots__/compileScript.spec.ts.snap | 20 +++++++++++++++++++ .../__tests__/compileScript.spec.ts | 16 +++++++++++++++ packages/compiler-sfc/src/compileScript.ts | 8 +++++--- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index 430b2993f61..4292327ca68 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -866,6 +866,26 @@ export default /*#__PURE__*/_defineComponent({ +return { } +} + +})" +`; + +exports[`SFC compile + + `) + assertCode(content) + expect(content).toMatch(`x: { type: Number, required: false }`) + expect(bindings).toStrictEqual({ + x: BindingTypes.PROPS + }) + }) + test('defineProps w/ type alias', () => { const { content, bindings } = compile(`