From: 三咲智子 Kevin Deng Date: Mon, 3 Apr 2023 08:49:16 +0000 (+0800) Subject: feat(types/slots): support slot presence / props type checks via `defineSlots` macro... X-Git-Tag: v3.3.0-alpha.7~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a2f5d59cffa36a99e6f2feab6b3ba7958b7362f;p=thirdparty%2Fvuejs%2Fcore.git feat(types/slots): support slot presence / props type checks via `defineSlots` macro and `slots` option (#7982) --- diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index f59a7407c2..ee00977c13 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -1785,6 +1785,51 @@ return { props, emit } })" `; +exports[`SFC compile + `) + assertCode(content) + expect(content).toMatch(`const slots = _useSlots()`) + expect(content).not.toMatch('defineSlots') + }) + + test('w/o return value', () => { + const { content } = compile(` + + `) + assertCode(content) + expect(content).not.toMatch('defineSlots') + expect(content).not.toMatch(`_useSlots`) + }) + + test('w/o generic params', () => { + const { content } = compile(` + + `) + assertCode(content) + expect(content).toMatch(`const slots = _useSlots()`) + expect(content).not.toMatch('defineSlots') + }) + }) + test('runtime Enum', () => { const { content, bindings } = compile( `