pingdotgg/ts-rust: An experimental Rust port of the TypeScript 7 compiler (tsc) · GitHub

I wished to see if LLMs may port the TypeScript compiler, checker and lsp to Rust. Turns out they will.
It cost over $420,000 in tokens to do it, however you might in all probability have finished it for ~$20k (see beneath)
- Test mannequin capabilities
- Make a quick TypeScript sort checker
- Make a ts checker that may work in WASM with excessive efficiency
- Memes
This is an early launch. It has 100% compatibility in each actual global community mission now we have
examined. It ought to work as a drop in
alternative for the overwhelming majority of apps. See Known problems.
Also value mentioning: I’ve by no means learn a line of this code.
Be warned, I don’t know if this may truly work.
npm set up -D tsc-rs
npx tsc-rs -p tsconfig.json
I used a whole lot of OpenAI fashions to attempt to full this port. In whole I did over $400,000 in API priced tokens with GPT-5.6 Sol and GPT 6 Astra. They wrote over 1.3m traces of Rust over a number of months of /aim loops and by no means bought previous like 84% compat.
When I noticed how little my Claude Code limits have been burning, I figured it would be enjoyable to throw Opus 5.5 at this. It had a working v0 in 10 hours.
I assumed it saved utilizing the code the Codex fashions wrote. I used to be incorrect. Opus 5.5 began from scratch. It bought additional than Astra in 1/tenth the time.
I let it preserve going, and it positively did. Total token spend was ~$24,047 of API spend over 2 weeks. I used to be utilizing my Claude accounts, and it labored out to someplace between 925% and 983% of my $200 plan weekly limits.
Expensive, for certain, however not that unhealthy contemplating how a lot work has went into typescript-go.
Everything beneath this was written by my LLMs, not me.
ts-rust is a direct port of Microsoft’s native TypeScript compiler, which is written in Go
(microsoft/TypeScript, previously
typescript-go). It retains Go’s algorithms and
habits and has the identical command line (tsc), language server and API.
npm set up -D tsc-rs
npx tsc-rs -p tsconfig.json
tsc-rs takes the identical choices as tsc. The npm bundle is tsc-rs in order that it doesn’t conflict
with the typescript bundle. Each release additionally
has a standalone archive per platform: the tsc binary with the lib recordsdata subsequent to it.
Platforms: Linux x64 (static, any distribution) and macOS arm64. Windows and Linux arm64 aren’t
out there but.
To use it in VS Code, see the npm package README.
tsc-rs has the Effect language service diagnostics in-built (codes
377xxx), so an Effect mission wants no second compiler. They come from the identical examine because the
TypeScript diagnostics, and the language server exhibits them too. They run solely when the tsconfig has
the plugin, as with @impact/language-service:
{ "compilerOptions": { "plugins": [{ "name": "@effect/language-service" }] } }
The guidelines, choices and @effect-diagnostics feedback are a port of
Effect-TS/tsgo 0.46.1. The editor options of the language
service (fast fixes, refactors, hover, completions) aren’t ported.
The port is pinned to at least one upstream revision, microsoft/TypeScript
673a5f17d713
(2026-09-29, TypeScript 7.1.0-dev; UPSTREAM.md), and in contrast with Go at that
revision. To examine, use [email protected], not 7.0.x or
@typescript/native-preview. A distinction that this construct additionally exhibits is upstream habits, and it
goes away when the port strikes to a more recent pin.
- Same outcomes. TanStack Query core and Hono examine with diagnostics equivalent to Go’s. All
181,711 ported Go checks cross. The language server and API solutions match Go on the oracle take a look at
units. - Faster. On 60 open-source tasks, sort checking takes about half of Go’s time (geometric
imply). The preview packages are in-built CI with out PGO and BOLT, so they’re slower than that
measured construct. - Real tasks. On 120 open-source repos, the command-line output differs from Go’s solely in
the issues beneath and the place Go’s personal output adjustments from run to run.
Full sort examine of T3 Code, in contrast with tsc 6, tsc 7
and the brand new bun examine in Bun. T3 Code makes use of Effect, so there are two instances: with out the Effect
diagnostics and with them. Each time is the sum for the 5 T3 Code tasks. Lower is quicker.
Without Effect diagnostics
| Checker | Time | vs tsc 6 |
vs tsc 7 |
|
|---|---|---|---|---|
bun examine |
4.07s | 15.4× | 3.95× sooner | █ |
tsc-rs |
7.25s | 8.6× | 2.22× sooner | ██ |
tsc 7 |
16.10s | 3.9× | baseline | █████ |
tsc 6 |
62.63s | baseline | 3.89× slower | ██████████████████ |
With Effect diagnostics
| Checker | Time | vs tsc 6 |
vs tsc 7 + Effect |
|
|---|---|---|---|---|
tsc-rs (Effect in-built) |
11.13s | 12.5× | 1.89× sooner | ███ |
tsc 7 + @impact/tsgo |
21.07s | 6.6× | baseline | ██████ |
bun examine, then effect-tsgo diagnostics |
37.60s | 3.7× | 1.78× slower | ███████████ |
tsc 6 + @impact/language-service |
138.63s | baseline | 6.58× slower | ████████████████████████████████████████ |
bun examine is the quickest when you do not want the Effect diagnostics. It doesn’t have them, so
an Effect mission wants a second cross. tsc-rs will get them from its one examine.
Errors. tsc-rs, tsc 7 + @impact/tsgo and the effect-tsgo diagnostics cross report the identical
221 Effect diagnostics. tsc 6 makes use of the JavaScript Effect plugin
(@impact/language-service 0.87.4), which has a unique rule set: it studies 287 on
apps/server the place the others report 177. tsc-rs and tsc 6 report yet one more error, TS2322 in
apps/server/scripts/record-pi-rpc-replay-fixture.ts. TypeScript 7.1.0-dev studies it too, and
pingdotgg/t3code#16704 fixes it.
How it was measured: the identical machine and methodology because the real-world apps beneath, with
--composite false added (apps/internet is composite). T3 Code at
cd41c4ad,
tasks apps/server, apps/internet, apps/cell, packages/client-runtime and
packages/shared. Without Effect, the configs haven’t any Effect plugin. With Effect, tsc 7 is the
Effect-patched 7.0.2 from @impact/tsgo 0.46.1, and tsc 6 is 6.0.3 patched with
@impact/language-service. The script is
scripts/bench-apps/t3code.sh. The tsc-rs swap in T3 Code is
pingdotgg/t3code#16704.
Full sort examine of six open-source apps with tsc 6 (the JavaScript compiler), tsc 7 (the Go
compiler), tsc-rs and bun examine. The multiplier is the speedup over tsc 6. Lower instances are
sooner.
| App | Lines checked | tsc 6 |
tsc 7 |
tsc-rs |
bun examine |
|---|---|---|---|---|---|
| VS Code | 3.75M | 54.56s | 6.84s (8.0×) | 4.20s (13.0×) | 1.62s (33.7×) |
| Sentry (frontend) | 2.11M | 58.76s | 7.90s (7.4×) | 4.46s (13.2×) | 3.14s (18.7×)* |
| Playwright | 585k | 4.48s | 0.66s (6.8×) | 0.34s (13.2×) | 0.18s (25.0×) |
| Excalidraw | 449k | 5.32s | 0.80s (6.7×) | 0.70s (7.6×) | 0.18s (29.0×) |
| TypeORM | 386k | 3.86s | 0.55s (7.0×) | 0.36s (10.7×) | 0.19s (20.0×) |
| tRPC (server bundle) | 209k | 1.10s | 0.16s (6.8×) | 0.09s (12.0×) | 0.12s (9.1×)* |
| Geometric imply | 7.1× | 11.4× | 20.9× |
Compared with tsc 7, tsc-rs is 1.61× sooner and bun examine is 2.95× sooner (geometric
means). bun examine is the quickest on each app besides tRPC.
* bun examine studies errors that no different checker studies: 3 on Sentry and a couple of on tRPC.
Each config checks with 0 errors below tsc 7.0.2. The different variations:
tsc-rsstudies 10 errors on VS Code and a couple of on Sentry. TypeScript 7.1.0-dev (typescript@subsequent)
studies the identical errors, line for line.tsc-rsports a 7.1 dev revision, which has checks that
7.0.2 doesn’t have.tsc6 studies 9 errors on VS Code.
How it was measured: Apple M4 Pro (12 cores, 48 GB), macOS 26.5.1. hyperfine,
median of 5 runs after 1 warmup run, with --noEmit --incremental false. Each checker makes use of its
default thread rely. tsc 7 and tsc-rs run as native binaries, with out the npm launcher.
tsc 6 runs on Node 24.19 with a 16 GB heap, as a result of it runs out of reminiscence on VS Code and Sentry
with the default heap. Versions: tsc-rs 0.1.0, TypeScript 7.0.2 and 6.0.3, Bun canary
bd599f5af. Lines checked is the tsc 7 --extendedDiagnostics rely, with the .d.ts recordsdata.
The T3 Code benchmark above makes use of the identical machine and methodology.
Four apps wanted adjustments to examine with 0 errors below tsc 7. Nothing else modified:
- Excalidraw: no
baseUrl, as a result of TS 7 eliminated it. - TypeORM:
moduleResolutionmodified fromnodetonodenext, as a result of TS 7 eliminatednode. - VS Code: the
electrontypings that its postinstall provides. - Playwright: the sources that its construct generates.
Two apps aren’t within the desk:
- rxjs predominant wants its workspace packages constructed first.
- date-fns makes use of mission references. There,
tsc -pandbun examinedo totally different work.
The scripts are in scripts/bench-apps: setup.sh , then
run.sh and abstract.py , and t3code.sh for T3 Code.
- In some monorepos, the supply recordsdata of a workspace bundle are reachable each by means of
node_modulesand thru a direct import. There,tsc-rscan write output for extra of these
recordsdata thantscdoes, and report TS6059 (file shouldn’t be belowrootDir) for them.tscdecides
this by timing, so its personal outcome adjustments between runs.tsc-rsoffers the identical lead to each
run (the results of TypeScript 6). - In
tsc -b, when one mission imports the output of one other mission with out a mission reference,
tsc-rscan learn the outdated or lacking output (TS2305 or TS2307) the placetscreads the brand new one.
This occurs when the tasks solely want to put in writing their outputs. Add the reference to repair it. - In the editor, reminiscence grows slowly throughout lengthy edit periods (about 20 MiB per 1,000 edits). It
stays beneathtsc‘s within the periods we measured. tsc-rs --versionprints the TypeScript model that it ports (7.1.0-dev), not the npm
model. The compiler matchessortsVersionsin opposition to it.
crates/ts_goport is the compiler. It has two components crates, goport_util and goport_lsproto,
in crates/ts_goport/components, and makes use of the lib recordsdata in crates/ts_goport/libs.
instruments/ts_ast_codegen generates crates/ts_goport/src/astdata, and
instruments/ts_diagnostics_codegen generates crates/ts_goport/src/diagnostics/catalog.rs and
crates/ts_goport/src/diag.rs. crates/ts_wasm is the WebAssembly construct
(npm/wasm).
./scripts/run-cargo-capped.sh construct --release -p ts_goport --bins
./scripts/confirm.sh
The bins are goport (sort examine) and tsgo (the Go tsgo command line). The Go baseline checks
run with
TS_GO_REPO=/path/to/typescript-go ./scripts/run-cargo-capped.sh take a look at -p ts_goport --test go_baselines.
Push a tag v (for instance v0.1.0). The
release workflow builds, packs and checks the packages, publishes
them to npm and creates a GitHub launch. A steady model goes to the dist-tag newest, and a
prerelease model (v0.2.0-beta.1) to subsequent and a GitHub prerelease. See
npm/README.md.
MIT. The port retains the licenses and notices of the code it ports: TypeScript
(Apache-2.0) and components of the Go normal library (BSD-3-Clause). See NOTICE.md.
