Add tsgo as an opt-in fast type-checker#1738
Merged
Merged
Conversation
Wires TypeScript 7's native compiler preview (tsgo, via @typescript/native-preview) in as a parallel `npm run typecheck:fast` script -- ~6-7x faster than tsc on this codebase, verified on the current tree. Purely additive: the committed build (tsconfig.build.json) and ESLint (@typescript-eslint/parser, still needs typescript 5.x since TS7 ships no compiler API) are untouched. Also pins `"strict": false` explicitly in tsconfig.json, documenting the current implicit default so TypeScript 7's flip of that default to true doesn't silently change type-check results on a future compiler bump. Verified byte-identical `tsc --noEmit` output before/after this pin. Co-Authored-By: Claude <noreply@anthropic.com>
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces @typescript/native-preview as a devDependency and adds a typecheck:fast script to run the native TypeScript compiler preview (tsgo). It also documents this dependency and explicitly sets "strict": false in tsconfig.json to avoid issues with future compiler upgrades. The reviewer suggested pinning the new dependency to the stable beta release (7.0.0-beta) instead of a nightly -dev build to prevent potential installation failures if the npm registry prunes old nightly tarballs.
Contributor
|
Reviewed; no blockers found. |
Gives a standing baseline to compare tsgo against tsc, rather than requiring an ad hoc invocation. Co-Authored-By: Claude <noreply@anthropic.com>
Addresses cb1kenobi's review on the companion harper-pro PR (#556): the typecheck:fast *script* is opt-in, but @typescript/native-preview as a plain devDependency means npm ci fetches this exact nightly tarball for every CI job, not just the checker. Documents why optionalDependencies isn't the fix (both harper and harper-pro are genuinely public npm packages, so it would leak this dev-only tool into every real end-user install) and formalizes accepting the pruning risk knowingly. Co-Authored-By: Claude <noreply@anthropic.com>
cb1kenobi
reviewed
Jul 9, 2026
Addresses cb1kenobi's review: as a plain devDependency, npm ci fetched this nightly tarball for every CI job (unit, integration, smoke, stress), not just the opt-in typecheck:fast script. Running it via `npx -y -p @typescript/native-preview@<pinned-version> tsgo ...` confines a pruned-tarball failure to typecheck:fast alone, matching its actually-opt-in nature. Trade-off: no package-lock.json integrity-hash pinning for this tool (version is still pinned in the npx invocation itself). Co-Authored-By: Claude <noreply@anthropic.com>
cb1kenobi
approved these changes
Jul 9, 2026
… tsgo fast-check (#1738) TypeScript 7 merges the native (Go-ported) compiler preview directly into typescript's own tsc binary, so the separate @typescript/native-preview package/tsgo binary is no longer needed once 7.0.2 is out. Still invoked via npx (not a package.json dependency) since typescript is already a 5.x devDependency here and npx resolves/caches the pinned 7.x tarball separately without colliding with it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
Adds
@typescript/native-preview(shipstsgo, the native/Go-ported preview compiler that becomes TypeScript 7'stsc) as a devDependency and wires it in as a newnpm run typecheck:fastscript.Purpose
Benchmarked on this exact codebase:
tsgo --noEmitis ~6.3x faster thantsc --noEmit(3.01s → 0.48s) with the same result set, and the emit path is ~6.7x faster too. This gives a much faster local/CI type-check loop as an opt-in parallel tool — it does not replace or touch the committedbuildscript (tsc --project tsconfig.build.json), and does not touch ESLint (@typescript-eslint/parserstill needstypescript5.x, since TypeScript 7.0 ships no compiler API — 7.1 will).Also pins
"strict": falseexplicitly intsconfig.json. The repo never setstrict, relying ontsc's implicit default (false); TypeScript 7 flips that default totrue. Verifiedtsc --noEmitoutput is byte-identical before/after this pin — it documents the status quo rather than changing behavior, and forward-guards against a future compiler bump silently changing type-check results.Where to focus review attention
tsgois pinned to an exact nightly-devbuild (7.0.0-dev.20260707.2), not a caret range. Nightly preview tags on the npm registry aren't guaranteed to persist indefinitely — if the tarball is ever pruned, a clean-cachenpm ciwould fail until the pin is bumped. Low impact (dev-only, opt-in, not a CI gate) but worth knowing about.dependencies.mdentry notestsgoships a prebuilt native (Go-compiled) binary via platform-gatedoptionalDependencies— no local compilation, but it's not a pure-JS package either.tsgotoday (none introduced by this PR, none blocking): a module-export resolution gap onserver/threads/manageThreads.js's dynamicmodule.exports.X = ...pattern (2 sites — already fixed as a side effect of Add type-strip mode: run Harper directly from .ts sources #562's CJS→ESM conversion, once that lands), plus two independent findings (security/auth.ts,server/REST.ts'sBuffer/BufferSourcetyping) worth a separate look but out of scope here.Generated by Claude (Opus 4.8).