TypeScript 3.9 slashes compile times for packages

New beta release addresses extremely poor editing and compilation speeds associated with packages such as material-ui and styled-components

TypeScript 3.9 slashes compile times for packages
Thinkstock

TypeScript 3.9, the next version of the popular typed superset of JavaScript from Microsoft, has arrived as a beta release, with fixes to address extremely poor editing and compilation speeds associated with some packages.

The TypeScript team had observed these performance issues with packages such as material-ui and styled-components. A series of six pull requests, covering operations such as using objects instead of closures for type mappers and optimizing of deferred type references, have resulted in significant reductions of compile times — roughly 40 percent in the case of material-ui, for example.

Also to boost speed, some changes have been made to file renaming functionality in editor scenarios. TypeScript 3.9, due as a production release on May 12, also includes improvements in a number of other areas. The highlights:

  • Improvements to the inference process, addressing a situation in which some regressions had occurred in previous updates to the declarations of functions like Promise.all and Promise.race.
  • Uncalled function checks, introduced in TypeScript 3.7 to report an error when a developer forgot to call a function, are now supported in ternary conditionals, essentially, the cond ? trueExpr : falseExp syntax.
  • For CommonJS auto-imports in JavaScript, TypeScript now automatically detects the types of imports being used to keep a file’s style clean and consistent.
  • Stricter checks on intersections and properties. This is a breaking change.

Released in beta on March 27, TypeScript 3.9 follows TypeScript 3.8, which became available in February. Not included in TypeScript 3.9 is an awaited type operator to model the way Promise unwrapping works in JavaScript. It had been anticipated for the release, but has been pulled from the main branch until more work can be done on it.

Copyright © 2020 IDG Communications, Inc.