maschwenk/tsrs

Rust port of the TypeScript 7 type checker

Rust

2

422 commits

updated Oct 1, 2026

See the code

See what people are saying

SourceMessageScoreDate

tsrs: Rust port of the TypeScript 7 type checker

4

Oct 1, 2026

README

Benchmark: tsrs vs tsgo 7.0.2

tsrs is a Rust port of the TypeScript 7 type checker (the Go compiler, "tsgo"). Each row type-checks one project from microsoft/typescript-benchmarking, the suite the TypeScript team benchmarks tsgo on (vscode, xstate-main, webpack, mui-docs, Compiler, Compiler-Unions), with tsgo 7.0.2 (npm typescript@7.0.2) and with tsrs at commit 955cd91b6dba: tsc -p <project> --noEmit, median of 3 interleaved runs, on Depot CI depot-ubuntu-24.04-8 (8 vCPU, 31 GB RAM, Linux x86_64, AMD EPYC 9R45 96-Core Processor).

Default mode: 4 checker threads in both (tsrs also resolves members lazily, its default)

projecterrors, tsgo / tsrstsgo wall (s)tsrs wall (s)speeduptsgo peak memorytsrs peak memorymemory, tsrs / tsgo
vscode359 / 371 (ref 371)12.504.392.84x7.82 GiB3.27 GiB0.42x
xstate-main0 / 00.960.332.89x748 MiB510 MiB0.68x
webpack848 / 840 (ref 840)1.520.662.30x1.21 GiB705 MiB0.57x
mui-docs0 / 013.782.365.85x8.16 GiB1.50 GiB0.18x
Compiler43 / 430.270.102.66x225 MiB215 MiB0.95x
Compiler-Unions41 / 410.520.192.68x248 MiB215 MiB0.87x

--singleThreaded: one checker thread in both

projecterrors, tsgo / tsrstsgo wall (s)tsrs wall (s)speeduptsgo peak memorytsrs peak memorymemory, tsrs / tsgo
vscode359 / 371 (ref 371)33.9214.122.40x6.61 GiB2.80 GiB0.42x
xstate-main0 / 01.860.862.18x606 MiB313 MiB0.52x
webpack848 / 840 (ref 840)3.401.632.08x940 MiB466 MiB0.50x
mui-docs0 / 014.984.393.41x3.61 GiB1.04 GiB0.29x
Compiler43 / 430.470.222.09x176 MiB107 MiB0.61x
Compiler-Unions41 / 410.830.421.95x203 MiB101 MiB0.50x

errors: the number of type errors each compiler reports on the project; they must be equal (a bold cell is a disagreement, i.e. a correctness bug). wall: process wall-clock time. speedup: tsgo wall / tsrs wall (above 1 = tsrs faster). peak memory: maximum resident set size. memory, tsrs / tsgo: below 1 = tsrs uses less.

(ref N): tsgo 7.0.2 and tsrs disagree, but typescript@7.1.0-dev.20260930.4, built from the TypeScript commit tsrs ports (b85298b6), reports exactly tsrs's errors: a TypeScript 7.0 vs 7.1-dev difference, not a tsrs bug.

Runner: Depot CI depot-ubuntu-24.04-8 (8 vCPU, 31 GB RAM, Linux x86_64, AMD EPYC 9R45 96-Core Processor). Date: 2026-10-01 17:05 UTC. tsrs commit: 955cd91b6dba. Numbers from shared CI machines are noisy; compare trends, not single runs. How it is measured: bench/README.md.

tsrs

A Rust port of the TypeScript 7 type checker. It is tsc --noEmit: same flags, same tsconfig, same diagnostics, byte for byte. No emit, no language service.

It ports the Go implementation in microsoft/TypeScript (tsc/internal) at commit b85298b6a81f function for function, and the Go code is the specification: on the TypeScript conformance suite the output matches the reference on 13,458 of 13,462 error baselines and on all 12,779 .types and .symbols baselines; the four exceptions are test-harness artifacts. docs/STATUS.md has the details and the comparison on a 38k-file production codebase.

Use it

npx -y @maschwenk/tsrs -p path/to/project        # macOS arm64/x64, Linux x64/arm64
npx -y @maschwenk/tsrs -p . --singleThreaded     # one checker thread (less memory)

or pnpm add -D @maschwenk/tsrs and run tsrs from scripts. --extendedDiagnostics prints the usual counters. By default tsrs also runs with checker changes that are not merged upstream yet; --noLazyMembers turns them off and gives the reference-identical mode. None of them changes any diagnostic (verified on the whole conformance suite, errors, types and symbols):

The last five are Go patches prepared from this port, not yet opened upstream (upstream/).

Build from source

cargo build --release -p tsrs_cli -p tsrs_testrunner
./target/release/tsrs -p path/to/project
./target/release/tsrs-test run --suite all --baselines types,symbols   # conformance suite, ~20 s

CONTRIBUTING.md covers the workflow; docs/PORTING.md, docs/AST.md and docs/CHECKER.md the conventions; tools/oracle/ the Go oracle programs that compare each stage against the reference.

Provenance

Derivative work of microsoft/TypeScript (Copyright Microsoft Corporation), Apache-2.0 like the original (LICENSE, NOTICE); the bundled lib.*.d.ts files are TypeScript's. Not affiliated with or endorsed by Microsoft. The port was written largely by AI coding agents directed and reviewed by Max Schwenk; its correctness rests on the evidence above rather than on review alone.

maschwenk/tsrs

Rust port of the TypeScript 7 type checker

Rust

2

422 commits

updated Oct 1, 2026

See the code

See what people are saying

SourceMessageScoreDate

tsrs: Rust port of the TypeScript 7 type checker

4

Oct 1, 2026

README

Benchmark: tsrs vs tsgo 7.0.2

tsrs is a Rust port of the TypeScript 7 type checker (the Go compiler, "tsgo"). Each row type-checks one project from microsoft/typescript-benchmarking, the suite the TypeScript team benchmarks tsgo on (vscode, xstate-main, webpack, mui-docs, Compiler, Compiler-Unions), with tsgo 7.0.2 (npm typescript@7.0.2) and with tsrs at commit 955cd91b6dba: tsc -p <project> --noEmit, median of 3 interleaved runs, on Depot CI depot-ubuntu-24.04-8 (8 vCPU, 31 GB RAM, Linux x86_64, AMD EPYC 9R45 96-Core Processor).

Default mode: 4 checker threads in both (tsrs also resolves members lazily, its default)

projecterrors, tsgo / tsrstsgo wall (s)tsrs wall (s)speeduptsgo peak memorytsrs peak memorymemory, tsrs / tsgo
vscode359 / 371 (ref 371)12.504.392.84x7.82 GiB3.27 GiB0.42x
xstate-main0 / 00.960.332.89x748 MiB510 MiB0.68x
webpack848 / 840 (ref 840)1.520.662.30x1.21 GiB705 MiB0.57x
mui-docs0 / 013.782.365.85x8.16 GiB1.50 GiB0.18x
Compiler43 / 430.270.102.66x225 MiB215 MiB0.95x
Compiler-Unions41 / 410.520.192.68x248 MiB215 MiB0.87x

--singleThreaded: one checker thread in both

projecterrors, tsgo / tsrstsgo wall (s)tsrs wall (s)speeduptsgo peak memorytsrs peak memorymemory, tsrs / tsgo
vscode359 / 371 (ref 371)33.9214.122.40x6.61 GiB2.80 GiB0.42x
xstate-main0 / 01.860.862.18x606 MiB313 MiB0.52x
webpack848 / 840 (ref 840)3.401.632.08x940 MiB466 MiB0.50x
mui-docs0 / 014.984.393.41x3.61 GiB1.04 GiB0.29x
Compiler43 / 430.470.222.09x176 MiB107 MiB0.61x
Compiler-Unions41 / 410.830.421.95x203 MiB101 MiB0.50x

errors: the number of type errors each compiler reports on the project; they must be equal (a bold cell is a disagreement, i.e. a correctness bug). wall: process wall-clock time. speedup: tsgo wall / tsrs wall (above 1 = tsrs faster). peak memory: maximum resident set size. memory, tsrs / tsgo: below 1 = tsrs uses less.

(ref N): tsgo 7.0.2 and tsrs disagree, but typescript@7.1.0-dev.20260930.4, built from the TypeScript commit tsrs ports (b85298b6), reports exactly tsrs's errors: a TypeScript 7.0 vs 7.1-dev difference, not a tsrs bug.

Runner: Depot CI depot-ubuntu-24.04-8 (8 vCPU, 31 GB RAM, Linux x86_64, AMD EPYC 9R45 96-Core Processor). Date: 2026-10-01 17:05 UTC. tsrs commit: 955cd91b6dba. Numbers from shared CI machines are noisy; compare trends, not single runs. How it is measured: bench/README.md.

tsrs

A Rust port of the TypeScript 7 type checker. It is tsc --noEmit: same flags, same tsconfig, same diagnostics, byte for byte. No emit, no language service.

It ports the Go implementation in microsoft/TypeScript (tsc/internal) at commit b85298b6a81f function for function, and the Go code is the specification: on the TypeScript conformance suite the output matches the reference on 13,458 of 13,462 error baselines and on all 12,779 .types and .symbols baselines; the four exceptions are test-harness artifacts. docs/STATUS.md has the details and the comparison on a 38k-file production codebase.

Use it

npx -y @maschwenk/tsrs -p path/to/project        # macOS arm64/x64, Linux x64/arm64
npx -y @maschwenk/tsrs -p . --singleThreaded     # one checker thread (less memory)

or pnpm add -D @maschwenk/tsrs and run tsrs from scripts. --extendedDiagnostics prints the usual counters. By default tsrs also runs with checker changes that are not merged upstream yet; --noLazyMembers turns them off and gives the reference-identical mode. None of them changes any diagnostic (verified on the whole conformance suite, errors, types and symbols):

The last five are Go patches prepared from this port, not yet opened upstream (upstream/).

Build from source

cargo build --release -p tsrs_cli -p tsrs_testrunner
./target/release/tsrs -p path/to/project
./target/release/tsrs-test run --suite all --baselines types,symbols   # conformance suite, ~20 s

CONTRIBUTING.md covers the workflow; docs/PORTING.md, docs/AST.md and docs/CHECKER.md the conventions; tools/oracle/ the Go oracle programs that compare each stage against the reference.

Provenance

Derivative work of microsoft/TypeScript (Copyright Microsoft Corporation), Apache-2.0 like the original (LICENSE, NOTICE); the bundled lib.*.d.ts files are TypeScript's. Not affiliated with or endorsed by Microsoft. The port was written largely by AI coding agents directed and reviewed by Max Schwenk; its correctness rests on the evidence above rather than on review alone.

Languages

Rust

95.3%

Go

2.0%

Python

1.8%