The port tracks the Go code of microsoft/TypeScript
(under tsc/, TypeScript 7.1.0-beta).
- Commit:
3e9236361fa9 - Commit date: 2026-10-19
- Same commit as the npm build
typescript@7.1.0-beta(itsgitHead): the release-7.1 merge of maind7d39da5c4. Itstsc/equalsd7d39da5c4exceptinternal/core/version.go. - Oracle:
tsc/cmd/tscbuilt with Go 1.27.1 (~/.local/bin/tsgo-oracle-3e9236361fa9) - Since R222 (bump E), after tsc-rs 0.8.0. tsc-rs 0.4.0 to 0.8.0 used the pin
fed0bf24149fbelow, and 0.3.0 and earlier the pin673a5f17d713.
tsc-rs output is meant to be byte-equal to tsc at this commit. When you compare, use the
pinned build, not typescript@7.0.x or @typescript/native-preview (its last build is from
July). A difference that the pinned build also shows is upstream behavior: it changes when the
port moves to a newer pin after upstream fixes it.
fed0bf24149f(2026-10-08, thegitHeadoftypescript@7.1.0-dev.20261008.1, oracle~/.local/bin/tsgo-oracle-fed0bf24149f): tsc-rs 0.4.0 to 0.8.0 (R191 to R221).673a5f17d713(2026-09-29, closest npm buildtypescript@7.1.0-dev.20260929.1): tsc-rs 0.3.0 and earlier. Behavior that differs between this pin and the current one is upstream change, for example the inference change of microsoft/TypeScript#64553 (in the nightlies from7.1.0-dev.20261001.1).
Before 2026-09-29 the port tracked
microsoft/typescript-go (now archived):
dc37b5249ab60e2bbce936f71b883e6c8136167e (2026-06-19), then pin B 16c25522e123. The tooling
below still names dc37b5249ab6 as the default pin in UPSTREAM.json; development runs select
the current pin with GOPORT_PIN=3e9236361fa9.
Generated Rust inputs under spec/ record their own source paths and must be
updated intentionally. Normal Cargo builds must not depend on a Go or Node
installation. Differential and baseline maintenance commands may use an
external upstream checkout and compiler oracle.
The default development oracle (dc37b5249ab6) is built from that checkout with Go 1.26.4:
CGO_ENABLED=0 go build -o ~/.local/bin/tsgo-oracle ./cmd/tsgoUPSTREAM.json is the machine-readable pin file: the current pin, every known pin (commit,
Go checkout, oracle path and sha256) and the oracle caches that belong to a pin. The default
paths above hold the current pin and do not change when a pin is added.
GOPORT_PIN=<key> (the first 12 hex digits of a pin commit) runs one command against another
pin. scripts/goport/gate.sh, sweep-wide.sh, compare-build.sh, scripts/tsgo-oracle.sh
and scripts/upstream/corpus.py honor it directly; remote.sh run passes it on. Any other
command honors it through scripts/upstream/pin.py exec -- <command>. The run gets a private
mount namespace where the default oracle, Go checkout and caches show the pin's files
(target/continuation-r97-goport/pins/<key>/...). With the variable unset nothing changes.
scripts/upstream/pin.py: show, path, exec, binds, add (checkout and oracle), sync (to a host).scripts/upstream/drift.py O N --out DIR: upstream commits from O to N as lane work lists, with the Rust functions each Go change reaches.scripts/upstream/rerecord.sh <key> [host]: re-records the Go-side evidence for a pin into its pin-keyed dirs;record.pyholds the recorders it adds.
The tests/go_baselines harness reads TS_GO_REPO; under pin.py exec its default path is
the pin checkout.
Some port-only shortcuts are exact only while some Go code stays as it is. At each pin bump, check
each one against Go at the new pin (drift.py lists the Go changes), and fix or drop the shortcut
when the condition no longer holds.
crates/ts_goport/src/flags.rsholds Go's integer flag and enum consts, kept in step by hand. Compare it withinternal/{ast,binder,checker,core}at the new pin.- Identity matching in inference (identmatch1) keeps each member's normalized type between the
pairs of one
inferFromMatchingTypescall, so it holds second copies of Go code (Go lines at3e9236361fa9):infer_from_identical_types(checker/inference_p1.rs) copies the loop ofinferFromMatchingTypes(inference.go:381, portinfer_from_matching_types);is_type_identical_in_matching(checker/inference_p2.rs) copiesisTypeRelatedTo(relater.go:169, portis_type_related_to_kindinchecker/relater_p1.rs);is_normalized_type_identical_in_matchingcopies the start ofisRelatedToEx(relater.go:2634-2665, portis_related_to_exinchecker/relater_p3.rs); andcheck_normalized_type_identical_tocopiescheckTypeRelatedToEx(relater.go:358, portcheck_type_related_to_ex) and the end of isRelatedToEx's identity branch (relater.go:2666). Check: a Go change in any of these functions goes into both copies. A kept type is exact only while a repeat ofgetNormalizedType(checker.go:28470) gives the first result. The guard covers two things. First, a repeat that makes something moves one of the counts thatnormalize_for_matchingcompares (instantiations, types, symbols, signatures, diagnostics), or emits only a tracer event (no type is kept with--generateTrace). Second, the path reads lazily set state that it does not compute in one place:IsEmptyAnonymousObjectType(checker.go:27077; for example in getIntersectionType and shouldNormalizeIntersection) readsMembersResolvedand does not resolve. So its answer for an anonymous type goes from false to true when the type's members are first resolved and are empty, also between two pairs.Checker::empty_anonymous_resolvescounts these resolves (resolve_structured_type_members_slow,checker/checker_p21.rs): a normalization during which it moves is not kept, and a kept type is used only while the count is the one it was kept with. The other reads on the path read cached or computed-once values, and a repeat reads what the first normalization read (audit of identmatch1 round 3,target/continuation-r97-goport/int97/r230repair/identmatch1r3/audit.md). At a bump, checkgetNormalizedTypeand the functions it calls (getReducedType, getIntersectionType, getUnionType, the simplifications) for a new step that makes or changes state that no count sees, and for a new read of lazily set state that does not compute it (anotherMembersResolvedread, or a field that is set later). Add a count for it or drop the slots. Checker::is_distribution_dependent(checker/relater_p5.rs) keeps the answer of its first walk on the conditional root (chkperf3). That is exact only while the walk (isTypeParameterPossiblyReferenced, checker.go:22891 atfed0bf24149f) reads only state that its first read fixes: the AST;resolvedSymbolof TypeReference nodes, whose one writer isgetSymbolFromTypeReference(checker.go:23606; TypeScript's JSgetTypeFromTypeReferencealso writes it); the write-oncegetResolvedSymbollinks (checker.go:14169); and the declarations of a resolved value symbol (check-timemergeSymbolclones a non-transient target before it appends, checker.go:14424-14449). A transient target is not cloned:mergeSymbolappends to its declarations in place (checker.go:14449). The merges ofinitializeChecker(checker.go:1309-1398: globals, pattern ambient modules, module augmentations) do that before any walk. At check time onlycombineSymbolTables(checker.go:16360) merges, when a late-bound member or export of a late-binding container has the name of an early one. The early symbol is transient only when an init merge made it, and it is a value that name resolution returns only in a corner (a function merged with a namespace across files, with a late-bound expando of the same name). That corner is not checked. Check:grep -n 'resolvedSymbol = ' internal/checker/*.go, the callers ofmergeSymbolandmergeSymbolTable, and the walk itself. If a new writer ofresolvedSymbolcan reach a TypeReference node (or the first identifier of atypeofquery), or the walk reads other state, drop the memo or clear it there.Type::member_mask(checker/types.rs, memberflags1): a new union or intersection stores the OR of its members' flags and of nested members' masks, andmaybe_type_of_kind(checker/checker_p30.rs) tests that mask in place of Go's walk (maybeTypeOfKind, checker.go:28211 at3e9236361fa9). That is exact only while no type's flags and no member list change after the type can be a member. At3e9236361fa9Go writesType.flagsafternewTypeat 3 places, each before the type can be a member: checker.go:24476 (an enum union getsEnumLiteral, portchecker_p26.rs), 26351 (a 2-member boolean union getsBoolean,checker_p28.rs) and 28795 (the regular type of an object literal,checker_p31.rs). OnlynewUnionTypeandnewIntersectionType(checker.go:25778, 25784) write the members of a union or intersection (the other.typeswrites are of tuple element lists and template literal types). Check:grep -nE '\.flags (\|=|&\^=|=) ' internal/checker/*.gofor a new write to a*Type's flags, andgrep -n '\.types = ' internal/checker/*.gofor a new write of members. If a new write can reach a type that is already a member, drop the mask.UnionCalls(checker/checker_p28.rs, unionmemo1):get_union_type_exkeeps the result of a call with no origin and no subtype reduction, and gives it to a later call with the same reduction, alias and types in the same order without Go's worker (getUnionTypeWorker, checker.go:26251 at3e9236361fa9). That is exact only while the data that the worker's sort and key read does not change once a type can be a member: the sort (CompareTypes, utilities.go:418) readsDeclarations()[0]of a type's symbol, also throughcompareSymbolsWorker(utilities.go:366). One case is open:mergeSymbol(checker.go:14422) appends declarations in place when its target is transient (checker.go:14454), and at check timecombineSymbolTables(checker.go:14372) merges. If such a merge gives a transient type symbol its first declaration between two equal calls, Go sorts again and can make another union, and the memo gives the old one. No case is known, and Go's ownunionTypescache (getUnionKey, checker.go:17940) rests on the same condition. Check:grep -n 'SetDeclarations(' internal/checker/*.gofor a write that can reach the symbol of a type that already exists, the callers ofmergeSymbol, and whatCompareTypes,compareSymbolsWorkerand the worker read. If such a write is found, or the worker gets a new effect (a counter, a cache write, a new type), drop the memo or moveUnionCalls::markat that step.
microsoft/typescript-go is archived. From 2026-08-19 the Go code is in
microsoft/TypeScript under tsc/, with Go 1.27 and
the module path github.com/microsoft/TypeScript/tsc. Pin B (16c25522e123) is tree-identical to
microsoft/TypeScript 51c91ec1d:tsc; the "equivalent" field of each old pin names its commit there.
pin.py add <full sha or main> --repo microsoft/TypeScriptfetches that one commit into~/.explore/repos/microsoft__TypeScript@<key>and buildstsgo-oracle-<key>fromtsc/cmd/tscwith Go 1.27.1. The pin record has"layout": "typescript","subdir": "tsc"andgoCheckout<checkout>/tsc. So underpin.py execthe default Go checkout path showstsc/, and tools findinternal/,cmd/andtestdata/where they always did.- The TypeScript submodule is gone. Its test cases are in
testdata/tests/cases(a case that collided with a Go case has the name intestdata/promotedTestCollisions.txt), thesubmodule*baseline dirs are merged into the plain dirs, and the.diffbaselines are gone.record.py corpusmaps the old sample paths.cmd/tsgois nowcmd/tsc. record.py typesymsrewrites the module path in its overlay main.drift.pyreads the new repo with--repo <clone> --subdir tsc.- Not adapted yet: the fourslash trace recorder (goport-ls
scripts/goport/fourslash-record),np-suite.sh(the client moved topackages/typescriptat the repo root) and thetests/go_baselinessubmodule runner. Bump C ports them (seetarget/continuation-r97-goport/upstream/bumpC/plan.md).
Some pin caches are inputs, not oracle outputs, because they come from the pin's Go tests or
API: the API traces (tests2/api/traces, built by scripts/goport/api_oracle.py build under
GOPORT_PIN; pins after dc37b5249ab6 speak API protocol 2), the fourslash LS traces
(ls-oracle/fourslash, recorded from the pin's fourslash tests) and the f1 sample case files
(record.py corpus). Build them at each pin before its oracle recording.