TypeScript goes 3.9

TypeScript goes 3.9

TypeScript has been updated with improvements to the latest release centered on performance, polish, and stability, according to the development team. The compiler and editing experience have been worked on to improve speed. 

TypeScript is a superset of JavaScript that adds optional static types which can be checked by the TypeScript compiler to catch common errors in your programs.

The developers say they worked on TypeScript’s performance after observing extremely poor editing/compilation speed with packages such as material-ui and styled-components. The changes optimize “certain pathological cases involving large unions, intersections, conditional types, and mapped types.”

Each of these pull requests gains about a 5-10% reduction in compile times on certain codebases. In total, the team says they’ve achieved around a 25% reduction the material-ui-styles project’s compile time.

They’ve also been told by teams at Microsoft that TypeScript 3.9 has reduced their compile time from 26 seconds to around 10 seconds.

The editor has also received attention, with better handling of CommonJS Auto-Imports in JavaScript. Until now, the assumption was that regardless of your file, you wanted an ECMAScript-style import. TypeScript now automatically detects the types of imports you’re using to keep your file’s style clean and consistent.

In terms of specific features, there are also improvements in Inference and Promise.all. Recent versions of TypeScript have had updates to the declarations of functions like Promise.all and Promise.race, but this has had a side effect of causing problems when used with values with null or undefined.

To counter this, the development team has improved the inference process in TypeScript 3.9. They say that if you’ve been avoiding upgrading your version of TypeScript due to issues around Promises, you should try version 3.9 because it’s a lot better.

However, the new awaited type operator the aims to accurately model the way that Promise unwrapping works in JavaScript has not made this build, because testing revealed it wasn’t ready.

More Information

Share with