diff --git a/packages/language-core/lib/codegen/template/element.ts b/packages/language-core/lib/codegen/template/element.ts index c53338f462..91af8b4bdb 100644 --- a/packages/language-core/lib/codegen/template/element.ts +++ b/packages/language-core/lib/codegen/template/element.ts @@ -358,6 +358,13 @@ export function* generateElement( else { yield* generateElementChildren(options, ctx, node, currentComponent, componentCtxVar); } + + if ( + node.props.some(prop => prop.type === CompilerDOM.NodeTypes.DIRECTIVE && prop.name === 'bind' && prop.exp?.loc.source === '$attrs') + || node === ctx.singleRootNode + ) { + ctx.inheritedAttrVars.add(`__VLS_intrinsicElements.${node.tag}`); + } } function* generateVScope( diff --git a/test-workspace/tsc/passedFixtures/vue3_strictTemplate/#4699/HelloWorld.vue b/test-workspace/tsc/passedFixtures/vue3_strictTemplate/#4699/HelloWorld.vue new file mode 100644 index 0000000000..b91a472477 --- /dev/null +++ b/test-workspace/tsc/passedFixtures/vue3_strictTemplate/#4699/HelloWorld.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/test-workspace/tsc/passedFixtures/vue3_strictTemplate/#4699/main.vue b/test-workspace/tsc/passedFixtures/vue3_strictTemplate/#4699/main.vue new file mode 100644 index 0000000000..724454b611 --- /dev/null +++ b/test-workspace/tsc/passedFixtures/vue3_strictTemplate/#4699/main.vue @@ -0,0 +1,9 @@ + + +