Skip to content

Commit 964ea64

Browse files
committed
fix(language-core): types imported in the <script setup> should not be used as a variable in template
close #4353
1 parent 72704dd commit 964ea64

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

packages/language-core/lib/parsers/scriptSetupRanges.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ export function parseBindingRanges(ts: typeof import('typescript'), sourceFile:
301301
if (node.importClause.namedBindings) {
302302
if (ts.isNamedImports(node.importClause.namedBindings)) {
303303
for (const element of node.importClause.namedBindings.elements) {
304+
if (element.isTypeOnly) {
305+
continue;
306+
}
304307
bindings.push(_getStartEnd(element.name));
305308
}
306309
}

test-workspace/tsc/#4353/main.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script setup lang='ts'>
2+
import { type PropType } from 'vue'
3+
</script>
4+
5+
<template>
6+
<!-- @vue-expect-error -->
7+
<input :data-t1="PropType.A" />
8+
</template>

0 commit comments

Comments
 (0)