Skip to content

chore(typecheck): typescript 7 runs the root and website typecheck, 2-5x faster - #569

Merged
arrzdev merged 1 commit into
mainfrom
chore/typescript-7-typecheck
Nov 16, 2026
Merged

arrzdev merged 1 commit into
mainfrom
chore/typescript-7-typecheck

Conversation

@arrzdev

@arrzdev arrzdev commented Nov 16, 2026

Copy link
Copy Markdown
Owner

What

pnpm typecheck (root: src/ and the CLI project) and pnpm --dir website typecheck now run TypeScript 7.0.2.

  • typescript-7 is a new devDependency, an npm alias of typescript@7.0.2. Both typecheck scripts call node node_modules/typescript-7/bin/tsc. typescript stays at 5.9.3.
  • tsconfig.json and website/tsconfig.json: baseUrl removed (TS 7 removed the option; every paths entry is already relative to the tsconfig).
  • tsconfig.bin.json: "strict": false written out. TS 7 defaults strict on; the CLI project was never strict and this keeps its checking as it was.
  • bin/adaptv.mjs, bin/lib/exec.mjs: three new Promise(...) whose resolve() takes no argument get a Promise<void> type (TS2810, new in 7).
  • CLAUDE.md: one toolchain bullet on why there are two TypeScripts.

Why

Typecheck is the slowest step of the gate before the tests. TypeScript 7 is the native compiler and does the same check in a fraction of the time.

typescript can't be replaced: 7 ships no JS API, and tsdown (dts: true) and four tests (stamp.test.ts, public-type-names.test.ts, website/.../imports.test.ts, playground/e2e/support/route-inventory.ts) import the compiler. Keeping 5.9.3 for those and using 7 for typecheck only means the build output is untouched.

Reproduce

Before: pnpm typecheck on main is the 5.9.3 tsc. After: pnpm typecheck shows typescript-7/bin/tsc. An injected export const x: number = "a" in src/ or website/src/ still fails with TS2322, exit 1.

Typecheck time, 3 runs each, same machine, run interleaved while the VM was loaded (so the ranges are wide):

Project TS 5.9.3 TS 7.0.2
root (tsc --noEmit + tsc -p tsconfig.bin.json) 19.3–30.0 s 3.9–7.2 s
website/ 6.9–14.1 s 1.3–2.0 s

On an idle run the same commands took 13.4 s → 2.1 s (root src/) and 8.9–9.6 s → 1.1–1.5 s (website).

New errors from 7: none beyond the ones fixed above (one baseUrl TS5102 per tsconfig, three TS2810 in bin/, and the implicit-any errors that came from strict defaulting on in the CLI project).

Verify

  • pnpm gate on this branch: green (biome root + playground, typecheck, vitest 5100 passed / 17 skipped, check-wrangler-envs, check-colour, build:check with publint and attw).
  • Emitted types unchanged: built dist/ twice (with and without the tsconfig.json change), diff -r of the two: identical, 42 .d.ts/.d.mts files included. No build tool reads the compiler other than 5.9.3.
  • pnpm --dir website lint: clean. pnpm --dir website test: 377 passed.
  • Frozen install from scratch twice: node_modules/.bin/tsc resolves to 7.0.2 and require("typescript") to 5.9.3 both times. The lockfile diff adds only typescript@7.0.2 and its platform packages.

Tested on / Not tested

Tested on: Linux x64, Node 22.23.3, pnpm 11.1.1.

Not tested: playground/ and examples/basic still run their own typescript 5.9.3 (the playground typecheck is not part of the CI gate); CI on other platforms; the Playwright suites (no runtime or service-worker code changed).

…-5x faster

TypeScript 7 has no JS API, so typescript 5.9.3 stays for tsdown's .d.ts build and the tests that import the compiler; typescript-7 (alias of typescript@7.0.2) runs the typecheck only. baseUrl is removed (7 dropped it; the paths entries resolve from the tsconfig), the CLI project pins strict: false (7 defaults it on), and three new Promise() calls in bin/ get a Promise<void> type.
@arrzdev
arrzdev marked this pull request as ready for review November 16, 2026 02:57
@arrzdev
arrzdev merged commit ba89ee6 into main Nov 16, 2026
6 checks passed
@arrzdev
arrzdev deleted the chore/typescript-7-typecheck branch November 16, 2026 03:19
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.

1 participant