Favicon of TypeScript Go

TypeScript Go

microsoft/typescript-go is a staging repo for TypeScript 7, a Go rewrite of the TypeScript compiler with a preview npm CLI and VS Code extension.

TypeScript Go website screenshot
TypeScript Go GitHub repository preview

typescript-go is Microsoft's staging repository for TypeScript 7, a native port of the TypeScript compiler and language service written in Go instead of TypeScript itself. It's aimed at TypeScript maintainers, tooling authors, and early adopters who want to try a faster compiler and language server before it merges into the main microsoft/TypeScript repo.

The project reimplements parsing, type checking, emit, and the language service in Go, matching the behavior of TypeScript 6.0 as closely as possible. It's not a new language or a fork with different semantics, it's meant to produce the same errors, types, and output as the existing JS-based compiler, just running natively.

Key features

  • Native compiler core: parsing, scanning, type resolution, and type checking are done, producing the same errors, locations, and messages as TypeScript 6.0.
  • tsgo CLI: a drop-in preview command line tool distributed via npm that works like tsc for compiling and checking projects.
  • Declaration and JS emit: full declaration file and JavaScript output emit, with declaration emit intentionally closer to real TS declarations than JS-inference-based ones.
  • Build mode and project references: build mode, project references, and incremental builds are implemented and considered done.
  • JSX and JSDoc support: JSX handling is complete, and JavaScript-specific inference/JSDoc support works, though intentionally missing some features found in the JS-based compiler.
  • VS Code extension: a preview extension lets you switch VS Code's TypeScript language features to use the native compiler via a settings flag.
  • In-progress language service: most LSP features (hover, completions, navigation, etc.) are implemented, with a few gaps remaining.
  • Watch mode prototype: file watching and rebuilding works, but without incremental rechecking yet, and it isn't optimized.

Ideal use cases

This repo fits developers who want to test the performance of a native TypeScript compiler on real projects and report bugs, or teams curious about early compile-time speedups on large codebases. It also suits contributors interested in compiler internals who want to help port remaining pieces, like the full API surface or watch mode.

It is not a good fit if you need a production-ready compiler today: the public API is marked "not ready," watch mode is only a prototype, and some tsconfig.json error messages are less helpful than in the JS compiler. Teams relying on advanced or edge-case module resolution modes may also hit gaps, since not all resolution modes are supported yet. If your workflow depends on programmatic use of the TypeScript API (plugins, custom build tools using the compiler API), stick with the standard typescript package until this API surface matures.

Installation

Install the preview package from npm and run it in place of tsc:

npm install @typescript/native-preview
npx tsgo # Use this as you would tsc.

Note that for TypeScript 7.0 RC and later releases, the command is renamed to tsc.

For editor integration, install the preview VS Code extension from the marketplace (TypeScriptTeam.native-preview), then enable it by adding this to your VS Code settings:

{
    "js/ts.experimental.useTsgo": true
}

Before filing issues, check the feature status table in the README: items marked "done" are safe to report bugs against, items marked "in progress" only warrant panic reports, and items marked "prototype" or "not ready" shouldn't be relied on or reported against yet. See CHANGES.md in the repo for a list of intentional behavior differences from TypeScript 6.0.

Categories:

Frequently asked questions

Share:

Stars
26.1K
Forks
1.1K
Last commit
9 hours ago
Repository age
2 years
License
Apache-2.0
Self-hosted
No
Activity score
82/100
View Repository
Ad
Favicon

 

  
 

Similar to TypeScript Go

Favicon

 

  
 
Favicon

 

  
 
Favicon