Add tsgo as an opt-in fast type-checker#556
Merged
Merged
Conversation
Companion to the same change in harper. Wires TypeScript 7's native
compiler preview (tsgo, via @typescript/native-preview) in as a
parallel `npm run typecheck:fast` script -- ~7x faster than tsc on
this codebase, verified on the current tree (including the core/
submodule). Purely additive: the committed `build` script (tsc,
still 5.x) is untouched in behavior, though it shares this tsconfig.json
with the new script (see below).
tsconfig.json changes, both verified byte-identical against tsc
--noEmit before/after (same commit, config swapped in/out):
- Removes `"baseUrl": "."` -- TypeScript 7 hard-errors on baseUrl
(TS5102). The existing `"paths": {"@/*": ["./dist/*"]}` is already
relative and resolves identically without it; confirmed no bare
imports in this repo relied on the baseUrl fallback.
- Pins `"strict": false` explicitly, documenting the current implicit
default (this repo already had `noImplicitAny: false` as one strict
sub-flag) so TypeScript 7's flip of the strict default to true
doesn't silently change results on a future compiler bump.
No harper-pro-level dependencies.md exists (only core/dependencies.md,
which belongs to the untouched vendored submodule), so no entry was
added there -- see PR description for the dependency justification.
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
|
Reviewed; no blockers found. |
There was a problem hiding this comment.
Code Review
This pull request introduces the @typescript/native-preview package and adds a fast type-checking script (typecheck:fast) using tsgo. It also updates tsconfig.json by explicitly disabling strict mode and removing the deprecated baseUrl option. The feedback suggests adding a standard typecheck script using tsc to serve as a stable baseline for comparison.
Addresses Gemini review feedback -- gives a standing baseline to compare tsgo against tsc, rather than requiring an ad hoc invocation. 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
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
Companion to harper PR #1738. Wires up
tsgo(TypeScript 7's native/Go-ported preview compiler) as a new opt-innpm run typecheck:fastscript (plus a plaintypecheckscript for a stable baseline, per review) — invoked vianpx, not apackage.jsondependency (see below).Purpose
Benchmarked on this codebase (including the
core/submodule):tsgo --noEmitis ~7.2x faster thantsc --noEmit(3.17s → 0.44s). Usage is opt-in — the committedbuildscript (stilltsc, 5.x) is behaviorally untouched, though it shares this sametsconfig.jsonwith the new script (harper-pro doesn't split build/check configs the way harper does).Two
tsconfig.jsonchanges were needed, both verified byte-identical againsttsc --noEmitbefore/after (isolated on one commit, config swapped in/out — 29/29 errors, no new/fixed errors either way):"baseUrl": "."— TypeScript 7 hard-errors on it (TS5102, "Option baseUrl has been removed"). The existing"paths": {"@/*": ["./dist/*"]}is already relative and resolves identically without it; confirmed no bare imports anywhere in this repo (including thecore/**/*included paths) rely on the baseUrl fallback."strict": false"explicitly — this repo already had"noImplicitAny": false"as one strict sub-flag, but relied ontsc's implicit default (false) for the rest. TypeScript 7 flips that default totrue; pinning it documents the status quo rather than changing behavior, and forward-guards a future compiler bump.Not a devDependency (resolved review thread with @cb1kenobi): an earlier version of this PR added
@typescript/native-previewas a plaindevDependency. Chris correctly pointed out that madenpm cifetch this exact nightly tarball for every CI job (unit, integration, smoke, stress), not just the opt-in checker — if that specific tarball is ever pruned from the registry, all of those jobs would fail, not justtypecheck:fast.optionalDependenciesdoesn't fix this either: bothharperandharper-proare genuinely public npm packages (verified against the registry — noprivatefield), so that would install-attempt this dev-only tool for every real end-user'snpm install. Chris's suggested fix — invoke it on demand vianpx -y -p @typescript/native-preview@<pinned-version> tsgo ...instead of adding it as a dependency at all — confines a pruned-tarball failure totypecheck:fastalone, matching its actually-opt-in nature. Trade-off: nopackage-lock.jsonintegrity-hash pinning for this tool (the version is still pinned in the npx invocation itself, just not hash-verified against a lockfile entry).Where to focus review attention
baseUrlremoval touches the tsconfig that also drives the realbuild— verified inert (see above), but flagging since it's shared config, not an isolated checker-only file.tsgofindings as harper (this repo'score/is the same submodule code) plus one more:replication/subscriptionManager.tshits the samemanageThreads.jsdynamic-export resolution gap. None introduced by this PR; themanageThreadsones are already fixed as a side effect of harper chore: Sync Core #562's CJS→ESM conversion once that lands.Generated by Claude (Opus 4.8).