From 65774a6cb6364f6d1e5b251c9da68fbc1dcd83fc Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Sat, 13 Apr 2024 01:10:27 +0900 Subject: [PATCH] fix(language-core): `@ts-ignore` not working for slots close #4263 --- .../language-core/lib/generators/template.ts | 3 ++- test-workspace/tsc/vue3/#4263/main.vue | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test-workspace/tsc/vue3/#4263/main.vue diff --git a/packages/language-core/lib/generators/template.ts b/packages/language-core/lib/generators/template.ts index f639fc1c9f..07ee00be7a 100644 --- a/packages/language-core/lib/generators/template.ts +++ b/packages/language-core/lib/generators/template.ts @@ -814,7 +814,6 @@ export function* generate( } const slotBlockVars: string[] = []; yield _ts(`{\n`); - yield* resetDirectiveComments('end of element slot start'); let hasProps = false; if (slotDir?.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) { @@ -868,6 +867,8 @@ export function* generate( localVars.set(varName, (localVars.get(varName) ?? 0) + 1); }); + yield* resetDirectiveComments('end of slot children start'); + let prev: CompilerDOM.TemplateChildNode | undefined; for (const childNode of node.children) { yield* generateAstNode(childNode, parentEl, prev, componentCtxVar); diff --git a/test-workspace/tsc/vue3/#4263/main.vue b/test-workspace/tsc/vue3/#4263/main.vue new file mode 100644 index 0000000000..17489d3673 --- /dev/null +++ b/test-workspace/tsc/vue3/#4263/main.vue @@ -0,0 +1,26 @@ + + +