Introduction
TypeScript 7 (codenamed tsgo) is Microsoft’s ambitious native Go port of the TypeScript compiler. With 25K+ stars on GitHub, this project represents a fundamental shift in how TypeScript is compiled – moving from a Node.js-based JavaScript implementation to a high-performance native Go binary. The result is dramatically faster compilation, lower memory usage, and a single static binary with zero dependencies.
What is TypeScript 7?
TypeScript 7 is a complete rewrite of the TypeScript compiler in Go. It maintains full compatibility with TypeScript 6.0 – producing the same type errors, locations, and messages – while leveraging Go’s native compilation and concurrency model for significantly better performance.
The project is currently available as a preview:
npm install @typescript/native-preview
npx tsgo # Use this as you would tsc.
A VS Code extension is also available on the marketplace, enabling you to use tsgo as your language service provider:
{
"js/ts.experimental.useTsgo": true
}
Architecture Overview
The TypeScript 7 compiler follows the same pipeline architecture as the original TypeScript compiler, but implemented in Go for native performance:
Compiler Pipeline
| Stage | Description | Status |
|---|---|---|
| Scanner | Tokenizes source code into a stream of tokens | Done |
| Parser | Converts tokens into an Abstract Syntax Tree (AST) | Done |
| Binder | Creates symbol tables and resolves declarations | Done |
| Checker | Performs type checking and error reporting | Done |
| Emitter | Generates JavaScript output, declarations, and source maps | Done |
Each stage is implemented in Go, taking advantage of goroutines for parallel processing where possible.
Feature Parity Status
The TypeScript 7 project has made remarkable progress toward full feature parity with TypeScript 6.0:
Completed Features
- Program Creation: Same files and module resolution as TS 6.0
- Parsing/Scanning: Exact same syntax errors as TS 6.0
- tsconfig.json Parsing: Configuration parsing complete
- Type Resolution: Same types as TS 6.0
- Type Checking: Same errors, locations, and messages
- JSX Support: Full JSX implementation
- Build Mode/Project References: Supported
- Incremental Build: Incremental compilation working
- Emit (JS Output): JavaScript generation complete
In Progress
- JavaScript Inference & JSDoc: Mostly complete, some features lacking
- Declaration Emit: Done for TypeScript files, not yet for JavaScript
- Language Service (LSP): Nearly all features implemented
Early Stage
- Watch Mode: Proof-of-concept, watches files and rebuilds but no incremental rechecking
- Public API: Not yet available
Performance Advantages
The Go native port provides significant performance improvements over the Node.js-based TypeScript compiler:
| Metric | TypeScript 6.x (Node.js) | TypeScript 7 (Go) |
|---|---|---|
| Cold Start | Slow (V8 warmup needed) | Fast (compiled binary) |
| Memory Usage | High (V8 heap overhead) | Low (no GC heap overhead) |
| Parallelism | Limited (single-threaded event loop) | Full (goroutines for concurrency) |
| Binary Distribution | Requires Node.js installation | Single static binary, no dependencies |
| Type Checking | Same as TS 6.0 | Same as TS 6.0 |
Key Benefits
- 5-10x faster cold starts – No V8 warmup overhead
- 3-5x lower memory usage – No JavaScript runtime heap
- Single binary deployment – No Node.js dependency required
- Full type-checking compatibility – Same errors, locations, and messages as TS 6.0
Ecosystem Integration
VS Code Integration
The preview VS Code extension is available on the marketplace, enabling tsgo as your TypeScript language service:
- Install the extension:
TypeScriptTeam.native-preview - Enable in settings:
"js/ts.experimental.useTsgo": true - Enjoy faster IntelliSense, diagnostics, and completions
npm Package
# Install globally
npm install -g @typescript/native-preview
# Or use in a project
npm install @typescript/native-preview
# Run as you would tsc
npx tsgo
CI/CD Pipelines
The single binary distribution makes TypeScript 7 ideal for CI/CD:
- No Node.js installation required
- Faster build times reduce feedback loops
- Smaller Docker images (no Node.js runtime)
- Consistent behavior across environments
Why Go?
Microsoft chose Go for the native port for several compelling reasons:
- Native Compilation: Go compiles to static binaries with no runtime dependencies
- Concurrency: Goroutines enable parallel type checking across multiple files
- Memory Efficiency: Go’s garbage collector has lower overhead than V8’s
- Cross-Platform: Single codebase compiles for all major platforms
- Fast Compilation: Go’s build system produces binaries quickly
- Familiar Patterns: Go’s type system and error handling map well to compiler construction
Current Limitations
As a preview release, TypeScript 7 has some important limitations:
- Not production-ready: Bugs may exist, treat as experimental
- No public API: The programmatic API is not yet available
- Watch mode is prototype: No incremental rechecking in watch mode
- Declaration emit incomplete: Works for TypeScript files but not JavaScript
- Long-term plan: This repo will eventually be merged into
microsoft/TypeScript
Getting Started
# Install the preview
npm install @typescript/native-preview
# Check your TypeScript files
npx tsgo
# Use in VS Code
# 1. Install the native-preview extension
# 2. Set "js/ts.experimental.useTsgo": true in settings
Conclusion
TypeScript 7 represents a bold step forward for the TypeScript ecosystem. By rewriting the compiler in Go, Microsoft is addressing long-standing performance complaints while maintaining the type safety that developers love. The project is still in preview, but the progress so far is impressive – with most core features already at parity with TypeScript 6.0.
If you work with large TypeScript codebases or need faster CI builds, TypeScript 7 is worth watching closely. The single binary distribution and native performance make it a compelling alternative for the future of TypeScript compilation.
Repository: microsoft/typescript-go Enjoyed this post? Never miss out on future posts by following us
Stars: 25,000+
Language: Go
License: MIT