News

TypeScript 3.9 Release Candidate Boosts Speed, Editor Functionality

As TypeScript 3.9 approaches general availability in the next couple weeks or so, the new release candidate boasts several speed improvements, along with better code editor functionality and other tweaks.

As the dev team continues its performance, polish and stability push, it has also sped up the compiler and enhanced the editing experience while reducing bugs and crashes.

No less than six different pull requests (PRs) to improve speed are included in the RC update.

"Our team has been focusing on performance after observing extremely poor editing/compilation speed with packages like material-ui and styled-components," said program manager Daniel Rosenwasser in an April 28 blog post. "We've dived deep here, with a series of different pull requests that optimize certain pathological cases involving large unions, intersections, conditional types, and mapped types."

A few of those PRs include:

  • Use objects instead of closures for type mappers
  • Optimize deferred type references
  • Reduce intersections by discriminants

Rosenwasser said that with each PR shortening compile times on specific codebases, the team has achieved about a 40 percent reduction in material-ui's compile time.

The code editing experience -- in Visual Studio 2017/2019, Visual Studio Code and Sublime Text 3 -- for JavaScript has also been improved, as that experience is driven by TypeScript.

Other highlights of the release include:

  • Improvements in Inference and Promise.all: A regression problem caused by updates to the declarations of functions like Promise.all and Promise.race has been fixed.
  • // @ts-expect-error Comments: "When a line is prefixed with a // @ts-expect-error comment, TypeScript will suppress that error from being reported; but if there's no error, TypeScript will report that // @ts-expect-error wasn't necessary."
  • Uncalled Function Checks in Conditional Expressions: A previously introduced feature, uncalled function checks, to report an error when a developer has forgotten to call a function, now works with ternary conditionals (the cond ? trueExpr : falseExpr syntax).

Rosenwasser said in the April 28 post that the stable TypeScript 3.9 release is expected in the next few weeks.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

Subscribe on YouTube