typescript-go README

The project's README from github.com/microsoft/typescript-go. As one markdown file: README.md.

This Repo Is Closed

This was the staging repo for the TypeScript 7.0 release during the native port process, which is now completed!

Please continue development and discussion in the original repo

This repo will be permanently archived in September 2026.

TypeScript 7

Not sure what this is? Read the announcement post!

Preview

A preview build is available on npm as @typescript/native-preview.

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

For TypeScript 7.0 RC and later, the command name is tsc.

A preview VS Code extension is available on the VS Code marketplace.

To use this, set this in your VS Code settings:

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

What Works So Far?

This is still a work in progress and is not yet at full feature parity with TypeScript. Bugs may exist. Please check this list carefully before logging a new issue or assuming an intentional change.

Feature Status Notes
Program creation done Same files and module resolution as TS 6.0. Not all resolution modes supported yet.
Parsing/scanning done Exact same syntax errors as TS 6.0
Commandline and tsconfig.json parsing done Done, though tsconfig errors may not be as helpful.
Type resolution done Same types as TS 6.0.
Type checking done Same errors, locations, and messages as TS 6.0. Types printback in errors may display differently.
JavaScript-specific inference and JSDoc done Complete, but intentionally lacking some features. Declaration emit differs greatly, intentionally, to be closer to TS declarations.
JSX done -
Declaration emit done -
Emit (JS output) done -
Watch mode done -
Build mode / project references done -
Incremental build done -
Language service (LSP) in progress Nearly all features implemented.
API not ready -

Definitions:

Other Notes

Long-term, we expect that this repo and its contents will be merged into microsoft/TypeScript. As a result, the repo and issue tracker for typescript-go will eventually be closed, so treat discussions/issues accordingly.

For a list of intentional changes with respect to TypeScript 6.0, see CHANGES.md.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit Contributor License Agreements.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

typescript-go (microsoft/typescript-go)

Searching Database…

26.1K ·GitHub
archived
这是什么?这里曾是 TypeScript 7.0 的过渡仓库——用 Go 编写的 TypeScript 编译器原生移植版。移植已经完成,所以这个仓库已关闭,开发工作搬回了原来的 microsoft/TypeScript 仓库。
这是 TypeScript 的分支(fork)还是重写?是重写:整个编译器——解析、类型检查、代码生成、监视模式和构建模式——全部用 Go 重新实现,取代原来的 JavaScript 代码库。长期计划一直是把它合并回 microsoft/TypeScript,现在这个目标已经实现了。
怎么把它跑起来?预览版发布在 npm 上,包名是 @typescript/native-preview——安装后运行 tsc 即可(这是 TypeScript 7.0 RC 及之后版本的命令名)。当时 VS Code 扩展市场还有一个预览版扩展。移植完成后,现在的正式版本都由 microsoft/TypeScript 发布。
用它需要装 Node 吗?不需要——编译器是 Go 编译的原生二进制文件,只要装好 npm 包就能运行。不过从源码构建这个仓库是另一回事:它是一个 npm workspace,需要 Node 20.19+ 和 hereby 任务运行器。
现在还应该用这个仓库吗?不应该——它已经关闭,并将于 2026 年 9 月永久归档。开发和讨论(包括 issue)都在原来的 microsoft/TypeScript 仓库进行。
这个 Go 编译器和我们现在用的 TypeScript 6 有多接近?根据仓库的状态表,程序创建、解析、tsconfig 处理、类型解析、类型检查、JSX、代码生成、监视模式、项目引用和增量构建都已完成——类型检查报告的错误、位置和消息与 TS 6.0 完全一致。语言服务当时仍在开发中,编译器 API 也尚未就绪。
有对应的 VS Code 扩展吗?有——VS Code 扩展市场发布过一个预览版扩展,通过 VS Code 配置里的一个设置项即可启用。它配合 @typescript/native-preview 编译器一起工作。
它能处理纯 JavaScript 和 JSX 吗?可以。JSX 已完成,JavaScript 特有的类型推断和 JSDoc 也已完善——不过某些 JS 特性是有意不支持的,JS 声明文件的生成也刻意做得更接近 TS 声明文件的风格。
为什么要用 Go 重写编译器?README 并没有说明动机,只是指向 TypeScript 7 的发布公告了解背景。这个仓库只是该原生移植版开发期间的过渡场地。
Creator
microsoft
Size
77.7 MB
Stars
26.1K
Age
2y
Commits · 90 Days