Repository navigation
chore(typecheck): typescript 7 runs the root and website typecheck, 2-5x faster - #569
Merged
Merged
Conversation
…-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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
pnpm typecheck(root:src/and the CLI project) andpnpm --dir website typechecknow run TypeScript 7.0.2.typescript-7is a new devDependency, an npm alias oftypescript@7.0.2. Both typecheck scripts callnode node_modules/typescript-7/bin/tsc.typescriptstays at 5.9.3.tsconfig.jsonandwebsite/tsconfig.json:baseUrlremoved (TS 7 removed the option; everypathsentry is already relative to the tsconfig).tsconfig.bin.json:"strict": falsewritten out. TS 7 defaultsstricton; the CLI project was never strict and this keeps its checking as it was.bin/adaptv.mjs,bin/lib/exec.mjs: threenew Promise(...)whoseresolve()takes no argument get aPromise<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.
typescriptcan't be replaced: 7 ships no JS API, andtsdown(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 typecheckonmainis the 5.9.3tsc. After:pnpm typecheckshowstypescript-7/bin/tsc. An injectedexport const x: number = "a"insrc/orwebsite/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):
tsc --noEmit+tsc -p tsconfig.bin.json)website/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
baseUrlTS5102 per tsconfig, three TS2810 inbin/, and the implicit-any errors that came fromstrictdefaulting on in the CLI project).Verify
pnpm gateon this branch: green (biome root + playground, typecheck, vitest 5100 passed / 17 skipped, check-wrangler-envs, check-colour,build:checkwith publint and attw).dist/twice (with and without thetsconfig.jsonchange),diff -rof the two: identical, 42.d.ts/.d.mtsfiles included. No build tool reads the compiler other than 5.9.3.pnpm --dir website lint: clean.pnpm --dir website test: 377 passed.node_modules/.bin/tscresolves to 7.0.2 andrequire("typescript")to 5.9.3 both times. The lockfile diff adds onlytypescript@7.0.2and its platform packages.Tested on / Not tested
Tested on: Linux x64, Node 22.23.3, pnpm 11.1.1.
Not tested:
playground/andexamples/basicstill run their owntypescript5.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).