Skip to content

fix(language-core): avoid type guards missing from tsc bundle in template binding analysis - #6214

Merged
KazariEX merged 1 commit into
vuejs:masterfrom
ValentinYoushkevich:fix/tsc-bundle-type-guards
Sep 27, 2026
Merged

KazariEX merged 1 commit into
vuejs:masterfrom
ValentinYoushkevich:fix/tsc-bundle-type-guards

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

Since #6181 and #6184, vue-tsc with a regular typescript package (5.4 to 6.0) stops checking every .vue file whose template has an interpolation. It logs ReferenceError: isDeleteExpression is not defined and reports no diagnostics for those files, so a project without other errors exits with code 0. That is the default create-vue setup (vue-tsc --build with typescript ~6.0.0). v3.3.11 is not affected.

vue-tsc resolves ts.* against TypeScript's tsc bundle, which drops type guards the compiler itself never calls: isDeleteExpression, isWhileStatement, isDoStatement, isBreakStatement, isContinueStatement, and on TypeScript 5.4 also isAsExpression and isTypeAssertionExpression. The typescript-native-bridge used in this repo still ships them, which is why the tests pass. This PR replaces those calls with local node.kind === ts.SyntaxKind.X checks, so behaviour stays the same.

Repro, with [email protected]:

<script setup lang="ts">
const msg: number = 1;
</script>

<template>
  {{ msg.notExist }}
</template>

vue-tsc --noEmit reports TS2339 on v3.3.11. On master it only logs the ReferenceError and exits 0.

@KazariEX
KazariEX merged commit e743e80 into vuejs:master Sep 27, 2026
5 checks passed
@ValentinYoushkevich
ValentinYoushkevich deleted the fix/tsc-bundle-type-guards branch December 4, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants