New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

Security News

TypeScript is Porting Its Compiler to Go for 10x Faster Builds

TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.

TypeScript is Porting Its Compiler to Go for 10x Faster Builds

Sarah Gooding

March 11, 2025

Microsoft has just announced a major shift in the evolution of TypeScript: they are porting the TypeScript compiler and tooling to Go. This transition, dubbed "Project Corsa," is aimed at massively improving performance, reducing memory usage, and enhancing developer experience. With a projected 10x speed increase, this move signals a major change for JavaScript and TypeScript developers alike.

Why Move Away from JavaScript?#

Since its inception, TypeScript has been implemented in TypeScript itself, running on the JavaScript runtime. While this brought benefits like easier contributions and alignment with the JavaScript ecosystem, it also came with limitations. According to Anders Hejlsberg, the lead architect of TypeScript, JavaScript is optimized for UI and browser usage rather than for compute-heavy tasks like compiling large codebases. As a result, TypeScript’s performance has been constrained by:

  • Long compilation times: As projects grow in size, developers face significant delays in build and editor response times.
  • High memory usage: Many developers report out-of-memory crashes when working with massive TypeScript projects.
  • JavaScript runtime overhead: The Just-In-Time (JIT) compilation model adds startup costs, while JavaScript’s flexible object model increases computational overhead.
  • Lack of shared memory concurrency: JavaScript does not natively support efficient parallel execution, limiting opportunities for performance optimizations.

To address these concerns, Microsoft decided to port TypeScript to a compiled language that better suits its workload.

Why Go?#

Everyone wants to know why the Microsoft team selected Go over other language options after hearing the news that TypeScript will is porting its compiler. This question is answered by Hejlsberg in the video announcement (2:30). When considering a new language for the TypeScript compiler, Microsoft explored multiple options, including C, C++, and Rust. However, Go emerged as the best choice for several reasons:

  • Performance and native execution: Go compiles to optimized native code across all platforms, eliminating JavaScript’s runtime overhead.
  • Efficient memory management: Unlike C++ or Rust, Go provides automatic garbage collection, reducing the complexity of memory management.
  • Concurrency support: Go’s built-in support for concurrency allows TypeScript to efficiently parallelize tasks like parsing, binding, and emitting files.
  • Simplified development and maintenance: Go strikes a balance between performance and developer productivity, making it easier to maintain and extend the TypeScript compiler.

Typescript Team Development Lead Ryan Cavanaugh also answered the "Why Go?" question in a lengthy FAQ announcement on GitHub. Ryan Cavanaugh explained that Go was chosen for the TypeScript compiler port because it allows for a structurally similar codebase, making it easier to maintain both the JavaScript and Go versions side by side.

Unlike a ground-up rewrite, Go’s memory management model simplifies development while maintaining strong control over memory layout. Its ergonomic handling of graph processing is also a major advantage, given TypeScript’s reliance on traversing abstract syntax trees. While Go's JavaScript interop is weaker, the team plans to mitigate this with a more intentional API design, ensuring long-term flexibility and performance improvements.

Expected Performance Gains#

Early benchmarks show that the new Go-based TypeScript compiler (tsc) delivers order-of-magnitude performance improvements. Here are some real-world examples Microsoft cited:

In editor scenarios, the improvements are just as dramatic. The time to load the entire VS Code project in the TypeScript language service drops from 9.6 seconds to just 1.2 seconds—an 8x improvement. Memory usage is also significantly lower, with further optimizations planned.

How Did They Achieve 10x Speed?#

The performance improvements stem from two main factors:

  1. Moving to native execution: Simply switching from JavaScript to Go yields about a 3-4x speed boost by eliminating JIT overhead and optimizing memory usage.
  2. Leveraging concurrency: The new compiler takes full advantage of parallel processing, with parsing, binding, and emitting files running concurrently. Type checking, which is harder to parallelize, is handled by multiple independent type checkers working on separate chunks of the program, achieving another 2-3x speedup.

Implementation Approach: A Port, Not a Rewrite#

Importantly, this is a port, not a rewrite. The TypeScript team is methodically porting the existing compiler "lock, stock, and barrel" to maintain identical semantics and behavior. This ensures that all the implicit behaviors and nuances of TypeScript's type system will remain consistent.

The port is well underway, with over 100,000 lines ported so far:

  • Scanner, parser, and binder are mostly complete
  • Type checker is approximately 80% complete
  • Work on the language service is ongoing

Roadmap for Porting TS Compiler to Go#

Microsoft is taking a phased approach to this transition. The roadmap includes:

  • Mid-2025: A preview version of the native tsc capable of command-line type checking.
  • Late 2025: A feature-complete implementation, including project builds and full language service support.
  • TypeScript 7.0: The first major release of the native compiler.

During the transition, Microsoft will continue maintaining the JavaScript-based TypeScript 6.x series for projects that rely on existing workflows. However, the long-term goal is for the Go-based compiler to fully replace the current implementation.

What This Means for Developers#

For TypeScript users, this change promises:

  • Faster feedback loops: Instant error detection, rapid navigation, and seamless refactorings.
  • Reduced memory footprint: Fewer crashes and better performance on resource-constrained environments.
  • Future AI enhancements: The added performance opens the door for AI-assisted coding features that were previously too expensive to compute.

Developers can try the new implementation today by building it from Microsoft’s working repository. As TypeScript 7 approaches, more stability and feature parity updates will follow.

Microsoft’s decision to port TypeScript to Go marks a new era for the language. By overcoming the performance constraints of JavaScript, this transition will deliver a significantly faster and more scalable development experience. While the change will take time to reach full maturity, the early results are promising, making this one of the most exciting developments in the TypeScript ecosystem to date.

For those eager to test it out, check the GitHub repository and stay tuned for updates from the TypeScript team. With a 10x speed boost on the horizon, the future of TypeScript looks incredibly bright.

Subscribe to our newsletter

Get notified when we publish new security blog posts!

Try it now

Ready to block malicious and vulnerable dependencies?

Install GitHub AppBook a demo

Related posts

Back to all posts