Introduction
TypeScript-Go is Microsoft's effort to rewrite the TypeScript compiler in Go for native performance. The goal is to bring type-checking and emit times down by an order of magnitude on large projects where the current JavaScript-based tsc can take tens of seconds.
What TypeScript-Go Does
- Performs full TypeScript type-checking using a native Go binary
- Emits JavaScript output compatible with the standard tsc compiler
- Provides a Language Server Protocol (LSP) implementation for editor integration
- Targets 1:1 compatibility with the existing TypeScript type system
- Runs as a standalone binary with no Node.js dependency required
Architecture Overview
The project is a line-by-line port of the TypeScript compiler source from JavaScript/TypeScript to Go. The scanner, parser, binder, checker, and emitter stages mirror the original architecture. By compiling to a native binary, it eliminates V8 JIT warm-up and garbage collection overhead, yielding significant speed gains especially on multi-million-line codebases.
Self-Hosting & Configuration
- Clone the repo and build with
go buildor use pre-built binaries when available - Run the compiler against your tsconfig.json just like standard tsc
- Editor integration is planned via an LSP server binary
- Existing tsconfig.json files and compiler options are supported as-is
- The project is still in preview; track the GitHub repo for release milestones
Key Features
- Up to 10x faster type-checking compared to the JavaScript-based tsc
- Native binary with zero Node.js runtime dependency
- Full TypeScript language compatibility as the target
- LSP support for real-time editor feedback
- Open source under Microsoft, backed by the TypeScript core team
Comparison with Similar Tools
- tsc (TypeScript) — the original JS-based compiler; TypeScript-Go is its native successor
- SWC — Rust-based transpiler that skips type-checking; TypeScript-Go does full checking
- esbuild — Go-based bundler/transpiler without type-checking; complementary tool
- Oxc — Rust-based JS toolchain focused on linting and parsing; different scope
- Biome — Rust linter/formatter; does not perform TypeScript type-checking
FAQ
Q: Will TypeScript-Go replace tsc? A: That is the long-term goal. Microsoft intends it to become the primary compiler once compatibility is validated.
Q: Does it support all TypeScript features? A: The aim is 100% compatibility. Some edge cases may lag during the preview period.
Q: Can I use it today? A: It is available as a preview. Check the repository for the latest build instructions and known limitations.
Q: Does it work with my IDE? A: LSP support is under development, which will enable integration with VS Code and other editors.