Skip to content

Commit

Permalink
fix(language-core): types imported in the <script setup> should not…
Browse files Browse the repository at this point in the history
… be used as a variable in template

close #4353
  • Loading branch information
johnsoncodehk committed May 8, 2024
1 parent 72704dd commit 964ea64
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/language-core/lib/parsers/scriptSetupRanges.ts
Expand Up @@ -301,6 +301,9 @@ export function parseBindingRanges(ts: typeof import('typescript'), sourceFile:
if (node.importClause.namedBindings) {
if (ts.isNamedImports(node.importClause.namedBindings)) {
for (const element of node.importClause.namedBindings.elements) {
if (element.isTypeOnly) {
continue;
}
bindings.push(_getStartEnd(element.name));
}
}
Expand Down
8 changes: 8 additions & 0 deletions test-workspace/tsc/#4353/main.vue
@@ -0,0 +1,8 @@
<script setup lang='ts'>
import { type PropType } from 'vue'
</script>

<template>
<!-- @vue-expect-error -->
<input :data-t1="PropType.A" />
</template>

0 comments on commit 964ea64

Please sign in to comment.