New release candidate addresses regression in TypeScript 3.4 that impacts build times and editor operations
TypeScript 3.5, the latest version of Microsoft’s popular typed superset of JavaScript, is now available in a release candidate. The update is set to add optimizations for type-checking, addressing a serious speed regression introduced with the previous release.
With TypeScript 3.5, Microsoft’s TypeScript development team focused on optimizing code paths and stripping down certain functionality to make TypeScript faster. Compile times have fallen compared to TypeScript 3.4; code completion and other editor operations should be “snappier” as well, the TypeScript developers noted.
In making these optimizations, the TypeScript team sought to mend a regression introduced in TypeScript 3.4 that could lead to a lot more work for the type-checker and increase type-checking times. The regression was serious because, in addition to leading to longer build times, editor operations for TypeScript and JavaScript users became “unbearably slow.” Those most impacted were developers using the styled-components library.
incremental
compiler option that reduce the time for rebuilds.lib.d.ts
declaration file to provide an Omit
helper type. The compiler will use this type to express types created through object rest destructuring on generics.allowUmdGlobalAccess
flag.unknown
.You can download the TypeScript 3.5 release candidate from NuGet or by using the following NPM command:
npm install -g typescript@rc
Much of the expressivity of our type system comes with a cost – any more work that we expect the compiler to do translates to longer compile times. Unfortunately, as part of a bug fix in TypeScript 3.4 we accidentally introduced a regression that could lead to an explosion in how much work the type-checker did, and in turn, type-checking time. The most-impacted set of users were those using the styled-components library. This regression was serious not just because it led to much higher build times for TypeScript code, but because editor operations for both TypeScript and JavaScript users became unbearably slow.
Over this past release, we focused heavily on optimizing certain code paths and stripping down certain functionality to the point where TypeScript 3.5 is actually faster than TypeScript 3.3 for many incremental checks. Not only have compile times fallen compared to 3.4, but code completion and any other editor operations should be much snappier too.
If you haven’t upgraded to TypeScript 3.4 due to these regressions, we would value your feedback to see whether TypeScript 3.5 addresses your performance concerns!