Introduction
TypeScript Go is Microsoft's official effort to port the TypeScript compiler from JavaScript to Go. The goal is dramatically faster type-checking and compilation, targeting a 10x speedup for large codebases while maintaining full compatibility with the existing TypeScript language.
What TypeScript Go Does
- Type-checks TypeScript projects using a Go-native compiler
- Produces identical diagnostics and output to the standard tsc compiler
- Parallelizes type-checking across CPU cores using Go goroutines
- Supports standard tsconfig.json configuration files
- Serves as a staging ground for the future native TypeScript toolchain
Architecture Overview
The compiler re-implements the TypeScript parser, binder, and checker in idiomatic Go. It leverages Go's built-in concurrency model to parallelize file parsing and type resolution. The project tracks the upstream TypeScript test suite to ensure behavioral parity with the JavaScript-based compiler.
Self-Hosting & Configuration
- Requires Go 1.22+ to build from source
- Uses the same tsconfig.json format as standard TypeScript
- Pre-built binaries are planned for major platforms
- Integrates with existing editor tooling via the Language Server Protocol
- Environment variable TSGO_MAX_PROCS controls parallelism
Key Features
- Up to 10x faster type-checking on large monorepos
- Full compatibility with TypeScript language semantics
- Parallel file processing via Go's concurrency primitives
- Lower memory usage compared to the Node.js-based compiler
- Backed by the official TypeScript team at Microsoft
Comparison with Similar Tools
- tsc (TypeScript) — the canonical JS-based compiler; TypeScript Go is its native successor
- swc — fast transpiler but does not perform type-checking
- esbuild — bundler with minimal TS support, no full type checking
- Oxc — Rust-based parser/linter; different scope
- Biome — linter/formatter, not a full compiler
FAQ
Q: Can I use TypeScript Go as a drop-in replacement for tsc? A: That is the goal once the project reaches feature parity. Currently it is a staging/preview build.
Q: Does it support all TypeScript features? A: It aims for full compatibility and tracks the upstream test suite, though some edge cases may still differ during development.
Q: How much faster is it in practice? A: Benchmarks on large projects show 5-10x speedup, varying by project size and complexity.
Q: Is this an official Microsoft project? A: Yes. It is developed by the TypeScript team at Microsoft.