mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
perf(typecheck): run the native TypeScript 7 compiler (#6356)
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.
This commit is contained in:
@@ -192,6 +192,12 @@ jobs:
|
||||
fi
|
||||
bun run check:migrations "$BASE_REF"
|
||||
|
||||
# Runs before the type-check itself: if a bare `tsc` has fallen back to the
|
||||
# JavaScript TypeScript 6 compiler that `@typescript/typescript6` drags in
|
||||
# transitively, the type-check below still passes — it just takes ~10x longer.
|
||||
- name: Native type-check audit
|
||||
run: bun run check:native-typecheck
|
||||
|
||||
# Every workspace, not just realtime. packages/emcn, packages/utils,
|
||||
# apps/desktop and apps/docs had no type check in CI at all; apps/sim's
|
||||
# source was covered only as a side effect of `next build` in the separate
|
||||
|
||||
Reference in New Issue
Block a user