Paul Krill
Editor at Large

TypeScript 3.9 slashes compile times for packages

news
May 13, 20202 mins

Latest TypeScript production release addresses extremely poor editing and compilation speeds associated with packages

mechanic wrench fix engine repair
Credit: Thinkstock

TypeScript 3.9, the latest version of the popular typed superset of JavaScript from Microsoft, is now available as a production release. The upgrade graduated from a release candidate stage and cross the finish line on May 12, 2020. 

TypeScript 3.9 emphasizes performance, polish, and stability. Microsoft has focused on fixes to address extremely poor editing and compilation speeds associated with some packages. The release can be installed through NuGet or NPM:

npm install typescript

The TypeScript team had observed 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 25 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 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.
  • New // @ts-expect-error comments. When a line is prefixed with this comment, TypeScript will suppress the error from being reported. If there is no error, TypeScript will report that the comment was unnecessary.
  • Improvements to preserve newlines.
  • Quick fixes for missing return expressions.
  • Support for “Solution Style” tsonfig.json files.
  • 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.
  • Getters and setters are no longer enumerable. Another breaking change, this pertains to a situation with older versions of TypeScript in which get and set accessors in classes were emitted in a way that made them enumerable, which was not in compliance with the ECMAScript specification.

Introduced 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.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author