From 49dd33d872e49a2777e3d979fb62d545a9eb940b Mon Sep 17 00:00:00 2001 From: KazariEX Date: Wed, 1 Oct 2025 12:42:17 +0800 Subject: [PATCH 1/2] fix: use component instance props as fallthrough attributes --- packages/language-core/lib/codegen/template/element.ts | 4 +++- .../fallthroughAttributes_strictTemplate/generic/basic.vue | 4 ++-- .../fallthroughAttributes_strictTemplate/generic/child.vue | 7 +++++-- .../fallthroughAttributes_strictTemplate/generic/main.vue | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/language-core/lib/codegen/template/element.ts b/packages/language-core/lib/codegen/template/element.ts index ed9c9e2987..ebab612e2d 100644 --- a/packages/language-core/lib/codegen/template/element.ts +++ b/packages/language-core/lib/codegen/template/element.ts @@ -265,7 +265,9 @@ export function* generateComponent( if (hasVBindAttrs(options, ctx, node)) { const attrsVar = ctx.getInternalVariable(); - yield `var ${attrsVar}!: Parameters[0]${endOfLine}`; + ctx.currentComponent.used = true; + + yield `var ${attrsVar}!: NonNullable${endOfLine}`; ctx.inheritedAttrVars.add(attrsVar); } diff --git a/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/basic.vue b/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/basic.vue index 2948bd76a6..9a155b83ee 100644 --- a/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/basic.vue +++ b/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/basic.vue @@ -2,10 +2,10 @@ import child from './child.vue'; defineProps<{ - foo?: T; + bar?: T; }>(); diff --git a/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/child.vue b/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/child.vue index 3e043b3148..16acba6785 100644 --- a/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/child.vue +++ b/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/child.vue @@ -1,5 +1,8 @@ - diff --git a/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/main.vue b/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/main.vue index e2e0faaf11..8494499af4 100644 --- a/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/main.vue +++ b/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/main.vue @@ -1,7 +1,8 @@ From f9248c0876b09d85d32a5d0e01a4c00cf7c69afe Mon Sep 17 00:00:00 2001 From: KazariEX Date: Wed, 1 Oct 2025 12:44:43 +0800 Subject: [PATCH 2/2] test: update --- .../fallthroughAttributes_strictTemplate/generic/basic.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/basic.vue b/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/basic.vue index 9a155b83ee..a9b11d9259 100644 --- a/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/basic.vue +++ b/test-workspace/tsc/passedFixtures/fallthroughAttributes_strictTemplate/generic/basic.vue @@ -7,5 +7,5 @@ defineProps<{