{"id":315,"date":"2025-03-13T15:27:48","date_gmt":"2025-03-13T15:27:48","guid":{"rendered":"https:\/\/redmonk.com\/kholterhoff\/?p=315"},"modified":"2025-03-13T15:27:48","modified_gmt":"2025-03-13T15:27:48","slug":"new-typescript-compiler-who-dis","status":"publish","type":"post","link":"https:\/\/redmonk.com\/kholterhoff\/2025\/03\/13\/new-typescript-compiler-who-dis\/","title":{"rendered":"New TypeScript Compiler, Who Dis?"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone wp-image-316\" src=\"http:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/lance-moteur.gif\" alt=\"\" width=\"100%\" height=\"788\" \/><\/p>\n<p>TypeScript is chugging an energy drink and sprinting laps around its old self. This week Microsoft announced a full migration of the TypeScript compiler to Go, and bragging of \u201c<a href=\"https:\/\/devblogs.microsoft.com\/typescript\/typescript-native-port\/\">A 10x Faster TypeScript<\/a>.\u201d Frontend developers may worry that TypeScript is having an existential crisis. More on that later. But for most workaday devs TypeScript code isn\u2019t changing. Instead, it&#8217;s the engine under the hood that\u2019s seeing improvement. <a href=\"https:\/\/www.linkedin.com\/in\/ahejlsberg\/\">Anders Hejlsberg<\/a>, Microsoft Fellow and TypeScript\u2019s lead architect, <a href=\"https:\/\/devblogs.microsoft.com\/typescript\/typescript-native-port\/\">explains<\/a> that by porting the TypeScript compiler and tools to Go they can now \u201cdrastically improve editor startup, reduce most build times by 10x, and substantially reduce memory usage.\u201d Sounds like an unmitigated glow up, but some folks in the JavaScript (JS) community like <a href=\"https:\/\/www.linkedin.com\/in\/evanyou\/\">Evan You<\/a>, creator of Vue.js, have been less enthusiastic. So let\u2019s discuss.<\/p>\n<p>If you\u2019ve been using TypeScript on a sizable project, you know the pain: the larger the codebase, the slower the type-checking and compiling. Running tsc (the TypeScript compiler) on a big project can feel like watching paint dry. Over the years, developers have grumbled that TypeScript\u2019s compiler is too slow, especially compared to some newer tools. In fact, according to <a href=\"https:\/\/www.linkedin.com\/in\/mapocock\/\">Matt Pocock<\/a>, independent educator at <a href=\"https:\/\/www.totaltypescript.com\/typescript-announces-go-rewrite\">Total Typescript<\/a>, \u201cImproved performance has been the community&#8217;s most-requested feature for years.\u201d Microsoft listened (and probably experienced the pain internally too). Thirteen years after its launch the Typescript team has decided to port the compiler in the lower-level, faster language Go.<\/p>\n<p><a href=\"https:\/\/bsky.app\/profile\/mitsuhiko.at\/post\/3lk6bys66nk2m\"><img decoding=\"async\" class=\"alignnone size-full wp-image-319\" src=\"http:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-11.09.54\u202fAM.png\" alt=\"\" width=\"75%\" height=\"1544\" srcset=\"https:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-11.09.54\u202fAM.png 1194w, https:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-11.09.54\u202fAM-232x300.png 232w, https:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-11.09.54\u202fAM-792x1024.png 792w, https:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-11.09.54\u202fAM-768x993.png 768w, https:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-11.09.54\u202fAM-1188x1536.png 1188w, https:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-11.09.54\u202fAM-480x621.png 480w, https:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-11.09.54\u202fAM-485x627.png 485w\" sizes=\"(max-width: 1194px) 100vw, 1194px\" \/><\/a><\/p>\n<p>Switching a compiler\u2019s programming language is noteworthy on a number of counts. For starters, it is not a new idea. In 2010 my colleague Steve O\u2019Grady <a href=\"https:\/\/redmonk.com\/sogrady\/2010\/02\/05\/hiphop\/\">wrote<\/a> about Facebook\/Meta\u2019s now defunct PHP transpiler, HipHop, whose value proposition was also speed. Next, Go was created by Google\u2014a competing hyperscaler\u2014so this move demonstrates Microsoft\u2019s relatively recent willingness to use technologies that weren\u2019t developed in-house. <a href=\"https:\/\/www.linkedin.com\/in\/arminronacher\/\">Armin Ronacher<\/a>, VP of Platform at Sentry, acknowledges Microsoft&#8217;s historically insular, Not Invented Here (NIH) vibe in his <a href=\"https:\/\/bsky.app\/profile\/mitsuhiko.at\/post\/3lk6bys66nk2m\">re-skeet<\/a> of Hejlsberg&#8217;s announcement.<\/p>\n<p>It\u2019s also worth emphasizing that Go is much closer to bare metal than TypeScript. Moving from a high-level, interpreted language (JavaScript\/TypeScript) to a low-level, compiled language (Go, Rust) brings tremendous speed gains. The current TypeScript compiler is written in TypeScript (which compiles to JavaScript), running on Node.js. That means every time you run the compiler, you\u2019re essentially firing up a JavaScript engine to interpret all that code. It\u2019s like instructing a butler who then instructs the chef to cook your meal\u2013polite, but not the fastest route to dinner. By contrast, a Go implementation compiles down to machine code ahead of time, running directly on your computer\u2019s processor without that intermediary. It\u2019s more like a chef who\u2019s ready to cook as soon as you\u2019re hungry.<\/p>\n<p>The results are dramatic, and promise to significantly improve developer experience. Hejlsberg <a href=\"https:\/\/devblogs.microsoft.com\/typescript\/typescript-native-port\/\">shares<\/a> some impressive benchmarks that, for example, the Visual Studio Code codebase (over 1.5 million lines of code) that took 77.8 seconds to type-check with the old compiler now takes about 7.5 seconds with the Go-powered compiler. The Playwright library (356k lines) dropped from 11.1s to 1.1s, while even smaller projects like date-fns saw ~9.5\u00d7 improvements. On the <a href=\"https:\/\/syntax.fm\/show\/884\/typescript-just-got-10x-faster\/transcript\">Syntax podcast<\/a>, Hejlsberg mentioned they can compile the entire Node.js codebase in 5\u20136 seconds now, whereas it previously took over a minute. For developers, shaving those seconds (or minutes) off build and type-check times means less thumb-twiddling and context-switching. Their IDE\u2019s IntelliSense and error squiggles will appear almost instantly instead of lagging behind their keystrokes. In practical terms: no more hitting \u201cbuild\u201d and then going for a coffee top-up; developers might not even have time to stretch before it\u2019s done.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/typescript\/typescript-native-port\/\"><img decoding=\"async\" class=\"alignnone size-full wp-image-318\" src=\"http:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-10.31.24\u202fAM.png\" alt=\"\" width=\"75%\" srcset=\"https:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-10.31.24\u202fAM.png 934w, https:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-10.31.24\u202fAM-300x177.png 300w, https:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-10.31.24\u202fAM-768x452.png 768w, https:\/\/redmonk.com\/kholterhoff\/files\/2025\/03\/Screenshot-2025-03-13-at-10.31.24\u202fAM-480x283.png 480w\" sizes=\"(max-width: 934px) 100vw, 934px\" \/><\/a><br \/>\n<sub>Chart from &#8220;<a href=\"https:\/\/devblogs.microsoft.com\/typescript\/typescript-native-port\/\">A 10x Faster TypeScript<\/a>&#8221; on Microsoft Dev Blogs.<\/sub><\/p>\n<p>So far, so good. But plenty in the community, like <a href=\"https:\/\/www.linkedin.com\/in\/maximilian-schwarzmueller\/\">Maximilian Schwarzm\u00fcller<\/a>, a developer educator, expected a <a href=\"https:\/\/maximilian-schwarzmueller.com\/articles\/typescript-is-ported-to-go-why-not-rust\/#:~:text=It%E2%80%99s%20important%20to%20understand%20that,or%20some%20other%20language\">rewrite in Rust<\/a>, the performance darling of many dev tools lately. Significant players in the JavaScript community have jumped on the Rust bandwagon (SWC, Deno, Rspack), and there\u2019s a feeling that Rust could have delivered equal or greater speed. According to one Hacker News <a href=\"https:\/\/news.ycombinator.com\/item?id=43333123\">poster<\/a>:<\/p>\n<blockquote><p>Why not something like Rust? Most of the JS ecosystem that is moving toward faster tools seem to be going straight to Rust (Rolldown, rspack (the webpack successor) SWC, OXC, Lightning CSS \/ Parcel etc) and one of the reasons given is it has really great language constructs for parsers and traversing ASTs (I think largely due to the existence of `match` but i&#8217;m not entirely sure)<\/p><\/blockquote>\n<p>Needless to say, the discussion on this point is lively. Although Microsoft\u2019s choice of Go has raised some eyebrows, they have solid reasoning. As <a href=\"https:\/\/dr-axel.de\/\">Dr. Axel Rauschmayer<\/a>, who has authored several books on JavaScript and TypeScript, explains, the TypeScript team wanted to <a href=\"https:\/\/2ality.com\/2025\/03\/typescript-in-go.html#:~:text=The%20TypeScript%20team%20wanted%20to,language%20%E2%80%93%20for%20two%20reasons\">port the codebase as-is<\/a> as much as possible, rather than completely rewrite from scratch. Porting means taking the existing logic and structure and expressing it in another language, whereas rewriting means re-architecting everything. Anders and his colleagues at Microsoft make it clear: a full rewrite in Rust would take too long and risk too much. The implication is that they could get 10\u00d7 speed in Go now rather than chase 15\u00d7 or 20\u00d7 with Rust years later.<\/p>\n<p>For frontend developers working in frameworks like React, Angular, and Vue, this means less waiting and more coding. Big monorepos with tons of TypeScript files that used to make VS Code\u2019s language server cry will load up with far fewer hiccups. Another area where developers will see improvements is with continuous integration (CI) and build processes. Many have CI pipelines that run tsc &#8211;noEmit just to do a type check, or that compile TypeScript before running tests. That step has often been one of the slowest in the pipeline. With a native compiler, CI builds will speed up.<\/p>\n<p>It\u2019s important to note, however, what this change will not do. It won\u2019t make your actual web app run faster in production because TypeScript is erased at runtime. Remember, TypeScript\u2019s job is done once it produces plain JavaScript output (or just checks types). By the time your code is running in a browser, the TypeScript compiler is out of the picture. As <a href=\"https:\/\/www.linkedin.com\/in\/fimion\/\">Alex Riviere<\/a>, Senior Frontend Developer at Hygiena, explained when I chatted with him about the update: \u201cthis isn\u2019t going to magically make your website faster\u2026 it\u2019s developer tooling.\u201d So don\u2019t expect your bundle size or page load times to shrink\u2014this is all about the development and build phase, not the end-user experience (although indirectly, faster tooling can lead to more optimized code or quicker iteration, which benefits users too, but I digress).<\/p>\n<p>One of the biggest concerns I have seen raised by the community is tied to running the TypeScript compiler in the browser. Today, in some instances you can actually run TypeScript in a web page. The official TypeScript Playground works in this way, and it\u2019s also used in online IDEs like StackBlitz, CodeSandbox, or VS Code for the Web. How? Well, since the compiler is written in JavaScript, they bundle it or dynamically load it and execute it right in the browser JavaScript engine. If the compiler is a Go binary, you can\u2019t run a binary in the browser \u2013 you\u2019d have to compile it to WebAssembly (WASM). WebAssembly lets you run compiled code on the web, but here\u2019s the thing: Go\u2019s performance in WASM isn\u2019t exactly stellar right now.<\/p>\n<blockquote class=\"twitter-tweet\" data-width=\"500\" data-dnt=\"true\">\n<p lang=\"en\" dir=\"ltr\">While I agree Go is the the pragmatic choice for a 1:1 port, my biggest concern is Go&#39;s relatively subpar WASM performance.<\/p>\n<p>As a data point, esbuild&#39;s WASM build performs quite poorly in web containers, even slower than js bundlers like Rollup.<\/p>\n<p>In the screenshot below, looks\u2026 <a href=\"https:\/\/t.co\/moy4nG1NsS\">https:\/\/t.co\/moy4nG1NsS<\/a><\/p>\n<p>&mdash; Evan You (@youyuxi) <a href=\"https:\/\/twitter.com\/youyuxi\/status\/1899642075425153385?ref_src=twsrc%5Etfw\">March 12, 2025<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n<p>Evan You <a href=\"https:\/\/x.com\/youyuxi\/status\/1899642075425153385?s=46&amp;t=CI39raeeTo17HPDC6XVTNw\">voiced<\/a> this worry on Twitter\/X: &#8220;While I agree Go is the pragmatic choice for a 1:1 port, my biggest concern is Go&#8217;s relatively subpar WASM performance.&#8221; You points out that esbuild\u2019s WASM build (esbuild is written in Go, and it offers a WASM version for browser use) performs poorly in the browser. In fact, it can be slower than JS bundlers like Rollup for in-browser operations.The upside is that the TypeScript team is aware of this, and efforts are ongoing to improve WASM support in Go (there\u2019s even a discussion in Go\u2019s <a href=\"https:\/\/github.com\/microsoft\/typescript-go\/discussions\/514\">GitHub repo<\/a>), so this may improve over time.<\/p>\n<p>And because it\u2019s 2025, and there has to be an AI story, Hejlsberg argues performance improvements in TypeScript will have significant repercussions in our LLM-assisted present, <a href=\"https:\/\/devblogs.microsoft.com\/typescript\/typescript-native-port\/\">explaining<\/a>:<\/p>\n<blockquote><p>This new foundation goes beyond today&#8217;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<\/p><\/blockquote>\n<p>While arguably an orthogonal concern, as developers move to create and consume more AI-native products, services, and systems, beyond just raw speed, performance improvements are a boon for developer tooling.<\/p>\n<p>Microsoft\u2019s decision to port TypeScript to Go is a big deal, and mostly in a good way. It addresses long-standing performance pain points with a pragmatic solution, uplevels TypeScript\u2019s development experience, and ensures that as apps and codebases grow, the tooling keeps up. There are some concerns, namely about specific scenarios like in-browser usage, but the overwhelming community sentiment that I\u2019m hearing is excitement.<\/p>\n<p><b>Disclaimer:<\/b> Microsoft, Google, and Sentry are RedMonk clients.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TypeScript is chugging an energy drink and sprinting laps around its old self. This week Microsoft announced a full migration of the TypeScript compiler to Go, and bragging of \u201cA 10x Faster TypeScript.\u201d Frontend developers may worry that TypeScript is having an existential crisis. More on that later. But for most workaday devs TypeScript code<\/p>\n","protected":false},"author":50,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[38,44,4,42,45],"tags":[],"class_list":["post-315","post","type-post","status-publish","format-standard","hentry","category-browser","category-compilers","category-javascript","category-node","category-programming-language"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/redmonk.com\/kholterhoff\/wp-json\/wp\/v2\/posts\/315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/redmonk.com\/kholterhoff\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/redmonk.com\/kholterhoff\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/redmonk.com\/kholterhoff\/wp-json\/wp\/v2\/users\/50"}],"replies":[{"embeddable":true,"href":"https:\/\/redmonk.com\/kholterhoff\/wp-json\/wp\/v2\/comments?post=315"}],"version-history":[{"count":0,"href":"https:\/\/redmonk.com\/kholterhoff\/wp-json\/wp\/v2\/posts\/315\/revisions"}],"wp:attachment":[{"href":"https:\/\/redmonk.com\/kholterhoff\/wp-json\/wp\/v2\/media?parent=315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/redmonk.com\/kholterhoff\/wp-json\/wp\/v2\/categories?post=315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/redmonk.com\/kholterhoff\/wp-json\/wp\/v2\/tags?post=315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}