deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (native)

Vercel Labs' tsc-ts rewrites the TypeScript 7 compiler in TypeScript as a native npm binary

Vercel Labs' experimental tsc-ts ports the TypeScript 7.0.2 (tsgo) compiler pipeline to TypeScript, compiles it natively with scriptc, and ships it via npm as per-platform binaries.

Vercel Labs' tsc-ts rewrites the TypeScript 7 compiler in TypeScript as a native npm binary

Vercel Labs has released tsc-ts, an experimental compiler that ports the TypeScript 7.0.2 codebase — the native compiler originally written in Go under the name TypeScript-Go, or tsgo — back into TypeScript, then compiles that TypeScript to a native executable. According to the project's repository on GitHub, which surfaced on Hacker News's front page on 17 October, the package installs like any other npm dependency and runs as a native binary.

How it is distributed

npm install -D tsc-ts followed by npx tsc-ts -p tsconfig.json is the entire setup. The main package does not contain the compiler itself; it dispatches to a platform-specific optional dependency such as @tsc-ts/darwin-arm64 or @tsc-ts/linux-x64-gnu that carries the prebuilt executable. The README notes the same code can also run under Node when built that way, and native builds locate TypeScript's bundled library files either next to the executable or through a TSC_TS_LIB_DIR environment variable.

A port verified stage by stage

The compiler lives in packages/tsc-ts/src/compiler and is a rendition of tsgo 7.0.2 in idiomatic TypeScript rather than a mechanical translation of the Go source. Correctness is established through differential testing: every compiler stage is compared against reference builds of tsgo — which the build fetches at a pinned commit — across TypeScript's own test corpus, roughly 12,500 files that expand to about 17,000 units once multi-file test cases are split apart.

The README's status table reports matching behaviour for every component examined: the scanner, the parser and AST, the binder, module resolution, tsconfig handling and program construction, command-line option parsing, the diagnostics catalog including 13 translations, JavaScript emit across 39 option sets, declaration and source-map emit, --build and --incremental scenarios including watch mode, and the type checker's per-file diagnostics.

Tooling over the API server

tsc-ts also ships an API server. Running tsc-ts --api serves the same stdin and stdout protocol as TypeScript 7.0.2's tsc --api, which means tools built against that interface — scriptc itself among them — can substitute tsc-ts without changes. The repository says the server has been checked against tsc --api 7.0.2 one response at a time.

Several language-service methods work, including getCompletionsAtPosition, getJsDocTags, getDocumentationComment, getReferencesToSymbolInFile, getReferencedSymbolsForNode and getSignatureUsages. Completions that depend on auto-imports report the same flag tsc --api returns. The profiling methods — startCPUProfile, stopCPUProfile and saveHeapProfile — are not supported.

Building from source

Building locally demands more than using it: Node.js 24 or newer, Go 1.26, and a machine that can act as a scriptc host (macOS, Linux or Windows) with clang available for linking. The build pins scriptc at exactly version 0.3.5 and fails with any other version, uses Turborepo to orchestrate tasks, and produces both the Node build and the tsgo reference builds used for comparison. Benchmark scripts time tsc-ts against tsgo and TypeScript's existing JavaScript compiler, though the README does not publish results. The project is Apache-2.0 licensed, with linting via oxlint and formatting via oxfmt.

Why it matters

TypeScript 7 exists because the compiler was rewritten in Go to escape the performance ceiling of running a type checker as JavaScript. tsc-ts inverts that premise: it keeps a TypeScript implementation of the same pipeline and asks a TypeScript-to-native compiler, scriptc, to produce the fast binary instead. If that compilation path matures, the TypeScript toolchain could stay in one language end to end while still shipping native executables, with npm's per-platform optional dependencies handling distribution in the same way other native tools in the JavaScript ecosystem already do.

The verification method is just as notable as the port. Differential testing of every compiler stage against reference tsgo builds, across the whole upstream corpus, is a disciplined way to demonstrate that a rewrite behaves identically, and the all-matches status table gives the experiment credibility that many experimental releases lack. The gaps — no profiling support, a hard pin on scriptc 0.3.5, no published benchmark numbers — mark it as a demonstration rather than production tooling today, but it is a concrete, working data point for what native TypeScript tooling could look like.

  • #typescript
  • #compilers
  • #npm
  • #open-source
  • #developer-tools

Related posts