perf(typecheck): run the native TypeScript 7 compiler - #6356
Conversation
A bare `tsc` was silently resolving to the JavaScript TypeScript 6 compiler. `apps/sim` depends on `@typescript/typescript6` for its runtime TypeScript AST API, which pulls in `@typescript/old` (an alias of `typescript@6`) declaring its own `tsc` bin. Package managers pick bin winners by lexical sort rather than dependency depth, so `@typescript/old` beat `typescript` and won `node_modules/.bin/tsc`. Identical diagnostics, ~10x slower, and it fails silently: the check still passes, it just burns minutes. Both compilers check an identical 11,066-source- file program with byte-identical diagnostics; the only `--listFiles` delta is lib relocation plus TS7 deduping nested .d.ts copies. The `@typescript/native` alias sorts ahead of `@typescript/old` and reclaims the bin. This is the TypeScript team's own recommendation on typescript-go#4567 -- the original blog example was wrong. Every `type-check` script is unchanged; `bunx tsc` and ad-hoc invocations are fixed too. apps/sim cold 83s -> 8.5s; all 23 workspaces 96s -> 9.4s. The alias is invisible-load-bearing: nothing imports it, so removing it looks like dead-dependency cleanup and costs 10x with no visible failure. check:native-typecheck asserts a bare `tsc` reports 7.x and fails CI otherwise. Also drops NODE_OPTIONS=--max-old-space-size=8192 from apps/sim's type-check -- it only ever mattered for the JS compiler's V8 heap.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview This adds a root Agent docs and skills now tell contributors to run Reviewed by Cursor Bugbot for commit 016f153. Configure here. |
Greptile SummaryThe PR makes the repository’s bare
Confidence Score: 5/5The PR appears safe to merge, with the compiler audit covering the bin-selection regression it is intended to prevent. The audit invokes the same root
|
| Filename | Overview |
|---|---|
| package.json | Adds the compiler audit command and root alias needed to win Bun’s tsc bin selection. |
| bun.lock | Resolves the new alias to the same native TypeScript 7.0.2 package already used by the repository. |
| scripts/check-native-typecheck.ts | Verifies that the exact root tsc shim used by workspace scripts reports TypeScript 7.x. |
| .github/workflows/test-build.yml | Runs the compiler-selection audit immediately before the monorepo type-check. |
| apps/sim/package.json | Removes a V8 heap option that does not apply to the native Go compiler. |
| CLAUDE.md | Documents the required type-check commands and the load-bearing dependency alias. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Install["bun install"] --> Alias["@typescript/native alias"]
Alias --> Shim["node_modules/.bin/tsc"]
Audit["check:native-typecheck"] --> Shim
Shim --> Version{"Reports TypeScript 7.x?"}
Version -->|Yes| Typecheck["Turbo workspace type-checks"]
Version -->|No| Fail["Fail CI before type-checking"]
Reviews (1): Last reviewed commit: "perf(typecheck): run the native TypeScri..." | Re-trigger Greptile
Summary
tscwas silently resolving to the JavaScript TypeScript 6 compiler, not the native TypeScript 7 one we already pin.apps/simneeds@typescript/typescript6for its runtime TypeScript AST API, and that pulls in@typescript/old(an alias oftypescript@6) which declares its owntscbin. Package managers pick bin winners by lexical sort, not dependency depth, so@typescript/oldbeattypescriptand wonnode_modules/.bin/tsc.@typescript/nativealias that sorts ahead of@typescript/old. Everytype-checkscript is unchanged, andbunx tsc/ ad-hoc invocations are fixed too.NODE_OPTIONS=--max-old-space-size=8192fromapps/sim'stype-check— it only ever mattered for the JS compiler's V8 heap.check:native-typecheckto CI. The alias is invisible-load-bearing: nothing imports it, so removing it looks like dead-dependency cleanup and costs 10x with no visible failure.apps/simcoldapps/simwarmType of Change
Testing
Verified both compilers check an identical 11,066-source-file program with byte-identical diagnostics — the only
--listFilesdelta is lib relocation plus TS7 deduping nested.d.tscopies, zero source files dropped..tsbuildinfo(17MB) does not cause a false pass under the native compiler@typescript/nativeresolves to the sametypescript@7.0.2tarball already in the lockfileChecklist