TypeScript-Go: Turbocharge Your Development with Microsoft's New Project
Want to combine the power of TypeScript with the efficiency of Go? Microsoft's TypeScript-Go project offers a promising path. While still under heavy development, this initiative aims to merge into the core TypeScript repository, bringing exciting possibilities for developers.
What is TypeScript-Go and Why Should You Care?
TypeScript-Go explores porting the TypeScript compiler to Go. This could potentially lead to:
- Performance Boost: Leverages Go's speed and efficiency for faster compilation times.
- New Platforms: Expands TypeScript's reach to platforms where Go excels.
- Unified Tooling: Streamlines development workflows by integrating TypeScript into Go ecosystems.
Getting Started with TypeScript-Go (Developer Preview)
Keep in mind that TypeScript-Go is a work in progress. There are no published packages yet, but eager developers can explore the project:
-
Clone the Repository: Use the following command, ensuring you include submodules:
-
Initialize Submodules (If Already Cloned):
-
Install Dependencies: Navigate to the project directory and run:
Key Commands for Development
The project leverages hereby
, similar to the main TypeScript repo, making common tasks easy:
hereby build
: Verifies the project builds successfully.hereby test
: Executes all tests.hereby install-tools
: Installs linters and other helpful tools.hereby lint
: Runs the linters to check code quality.hereby format
: Automatically formats the code.hereby generate
: Generates Go code (e.g., diagnostics).
Don't worry; hereby
is just a convenience. Regular Go tooling (go build
, go test
, etc.) works as expected.
Running and Testing 'tsgo'
After building, you can find the executable at built/local/tsgo
. It aims to mimic the behavior of the standard tsc
command.
-
Basic Usage:
built/local/tsgo
(respects tsconfig and outputs performance stats). -
For closer
tsc
behavior:built/local/tsgo tsc [flags]
Prototype LSP Experience: Dive into Code Completion
Want to experience the language server protocol (LSP) prototype? Follow these steps:
- Open the Project in VS Code:
code .
from the repository root. - Copy Launch Configuration: Copy
.vscode/launch.template.json
to.vscode/launch.json
. - Start Debugging: Press F5 or use the "Debug: Start Debugging" command in VS Code.
A new VS Code instance will launch, using the Corsa LS backend. Verify "typescript-go" is selected in the Output pane.
Contributing to TypeScript-Go
Microsoft encourages contributions! Take time to check the Contributor License Agreements before submitting a pull request, and adhere to the Microsoft Open Source Code of Conduct.