Supercharge Your Go Development: Microsoft's TypeScript-Go Project Unveiled!
Want to leverage the power of TypeScript in your Go projects? Microsoft's typescript-go
project offers a new way to integrate these technologies. This article dives into this exciting project, revealing how it works and how you can get involved.
Unlock the Potential: What is typescript-go
?
Microsoft's typescript-go
is an experimental project that aims to bring TypeScript's type-checking and tooling to Go development. While still in active development, it offers a glimpse into a future where Go developers can benefit from TypeScript's robust features. The ultimate goal is to eventually merge its contents into the main TypeScript repository.
Get Your Hands Dirty: Building and Running typescript-go
Ready to explore? Setting up the project requires a few steps:
-
Prerequisites: Ensure you have Go 1.24+, Rust 1.85+, and Node.js with npm installed.
-
Clone with Submodules: Use the command
git clone --recurse-submodules https://github.com/microsoft/typescript-go.git
to include the necessary TypeScript repository submodule. If you have already cloned the repository use:git submodule update --init --recursive
. -
Run Build Tasks with Hereby: After cloning, use
npm ci
to install dependencies. You can run tasks usinghereby
:hereby build
: Verifies the project builds successfully.hereby test
: Executes all project tests.hereby install-tools
: Installs linters and other helpful tools.hereby lint
: Runs the configured linters.hereby format
: Formats the codebase for consistency.hereby generate
: Generates Go code, such as diagnostics.
Testing the Waters: Running tsgo
and the LSP Prototype
After building, built/local/tsgo
becomes your entry point. It mimics tsc
's behavior, respecting tsconfig
and providing performance statistics. To test the Language Server Protocol (LSP) prototype, which is built with Corsa LS:
- Open the project in VS Code (
code .
). - Copy
.vscode/launch.template.json
to.vscode/launch.json
. - Start debugging (F5 or "Debug: Start Debugging" from the command palette).
If configured correctly, a new VS Code instance will launch, using Corsa LS as the backend. When the new instance launches, you should see "typescript-go" as an option in the Output pane.
Status Check: Features in Development
Keep in mind that typescript-go is a work in progress. Features are categorized as:
- done: Functionality believed to be complete; bug reports are welcome.
- in progress: Actively being developed; panics are acceptable bug reports.
- prototype: Proof-of-concept only; bug reports are generally not needed.
- not ready: Not yet started or too early for testing.
Intentional Changes
Be sure to review the CHANGES.md
file for a list of differences between typescript-go and TypeScript 5.7. Always check this document before submitting bug reports.
Contribute and Shape the Future of TypeScript-Go
Microsoft encourages contributions to the project. Be sure to sign the Contributor License Agreement (CLA) when requested. The project follows the Microsoft Open Source Code of Conduct. You can read the Code of Conduct FAQ if you have any related questions.
Embrace the fusion of TypeScript and Go with typescript-go
! Contribute to its development and unlock new possibilities for your Go projects.