Microsoft has announced it has been working on creating a native implementation of the TypeScript compiler and tools, significantly improving editor startup time, reducing build time, and drastically cutting down on memory usage.

TypeScript is a language that builds on JavaScript, but according to Anders Hejlsberg, lead architect of TypeScript, JavaScript does have its limitations. 

“Since the inception of TypeScript more than a decade ago, TypeScript has been written in itself,” he said. “That’s brought a lot of benefits, but it’s also consistently brought some challenges, in particular around performance and scalability. The JavaScript runtime platform is really optimized for UI and browser usage, and not so much for compute intensive workloads like compilers and system level tools.”

According to Hejlsberg, one of the most commonly reported issues by customers is that they run into is out of memory situations, especially as their codebases grow. “We’ve likely reached the limit of what we can squeeze out of JavaScript,” he said.  

The codebase is being ported to Go for this native implementation, as Hejlsberg said that this language is the most suitable for what they’re trying to achieve. “It’s the lowest level language we can get to that gives us full optimized native code support on all platforms, great control over data layout, the ability to have cyclic data structures and so forth. It gives you automatic memory management with a garbage collector, and great access to concurrency,” said Hejlsberg.  

While a feature-complete version of this native implementation isn’t expected to be available until later this year, this new implementation can already load many popular TypeScript repos, including VS Code, Playwright, TypeORM, date-fns, and more. 

The JavaScript-based TypeScript takes 77.8 seconds to compile the VS Code codebase, whereas the native implementation takes 7.5 seconds, which is a 10x improvement. Playwright takes 1.1 second with the new implementation, compared to 11.1 seconds.

“We’re incredibly excited about the opportunities that this massive speed boost creates,” Hejlsberg wrote in a blog post. “Features that once seemed out of reach are now within grasp. TypeScript can provide instant, comprehensive error listings across an entire project, support more advanced refactorings, and enable deeper insights that were previously too expensive to compute. This new foundation goes beyond today’s developer experience and will enable the next generation of AI tools to enhance development, powering new tools that will learn, adapt, and improve the coding experience.”

According to Microsoft, this native implementation will be released as TypeScript 7.0 when it reaches parity with the current version of TypeScript (the most recent version is TypeScript 5.8). It will continue releasing the JavaScript-based version throughout the 6.x releases, and will be introducing changes and deprecations to align it with the native codebase.

Some projects may be able to switch to native TypeScript 7 when it is released, but some others may depend on API features, legacy configurations, and other constraints that will require them to use the JavaScript-based TypeScript 6. 

“Recognizing TypeScript’s critical role in the JS development ecosystem, we’ll still be maintaining the JS codebase in the 6.x line until TypeScript 7+ reaches sufficient maturity and adoption. Our long-term goal is to keep these versions as closely aligned as possible so that you can upgrade to TypeScript 7 as soon as it meets your requirements, or fall back to TypeScript 6 if necessary,” Hejlsberg wrote.

The company plans on sharing more information over the coming months, but for now has put together an FAQ and will be hosting an AMA in the TypeScript Discord on March 13th starting at 1 PM ET | 10 AM PT.