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

OpenAI models ported TypeScript 7 compiler to Rust for $24k.

13 cards · 1m 50s · tap to begin

From · · 1m 50s

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

OpenAI models ported TypeScript 7 compiler to Rust for $24k.

In brief

OpenAI models ported TypeScript 7 compiler to Rust for $24k. OpenAI models created a Rust version of TypeScript 7 compiler that works with 120 open-source projects. Originally reported by GitHub.

ts-rust

ts-rust is an experimental Rust port of Microsoft's TypeScript compiler that works with 120 open-source projects.

“ts-rust (aka tsc-rs)”

Cost to build

It cost over $420,000 in tokens to port TypeScript 7 to Rust using OpenAI models, but the final version cost ~$24,047.

“it cost over $420,000 in tokens to do it, but you could probably have done it for ~$20k”

Motivations

Motivations

The project aimed to test LLMs, create a fast TypeScript type checker, and build a compiler that works in WASM with high performance.

“motivations test model capabilities make a fast typescript type checker make a ts checker that can work in wasm with high performance”

Model performance

Opus 5.5 completed the port in 10 hours, writing over 1.3 million lines of Rust code with 84% compatibility.

“it had a working v0 in 10 hours”

Installation

Install with npm install -D tsc-rs and run npx tsc-rs -p tsconfig.json for a drop-in replacement.

“npm install -D tsc-r. npx tsc-rs -p tsconfig.json”

Effect diagnostics

tsc-rs includes Effect language service diagnostics built in, requiring no second compiler for Effect projects.

“tsc-rs has the effect language service diagnostics built in (codes 377xxx)”

Compatibility

tsc-rs has 100% compatibility with 120 open-source projects and passes all 181,711 Go tests.

“it has 100% compatibility in every real world project we have tested”

Benchmark results

tsc-rs is 7.1× faster than TypeScript 6 on average and 1.61× faster than TypeScript 7 on real-world apps.

“geometric mean seven point one times”

Real-world apps

tsc-rs runs faster than TypeScript 6 on VS Code, Sentry, Playwright, Excalidraw, TypeORM, and tRPC.

“vs code sentry playwright excalidraw typeorm tRPC”

Known problems

tsc-rs reports errors in monorepos and has memory issues during long edit sessions.

“in some monorepos the source files of a workspace package are reachable both through node_modules and through a direct import”

Development

The project uses Rust crates for the compiler and has tools for generating code and testing.

“crates/ts_goport is the compiler”

Releases

Releases are tagged with v<version> and published to npm with GitHub releases.

“push a tag v<version> for example v0.1.0”

License

The project uses MIT license with TypeScript (Apache-2.0) and Go standard library (BSD-3-Clause).

“mit the port keeps the licenses and notices of the code it ports typescript apache-2.0 and parts of the go standard library bsd-3-clause”

The main idea

OpenAI models created a Rust version of TypeScript 7 compiler that works with 120 open-source projects.

Read the original on GitHub

React

Sign in to react and comment.

Comments (0)

Life is short. Keep it sweet. Respect others' opinions and be kind!

    Recommended next

    More decks on ts-rust and related topics.