days
0
-35
-6
hours
-2
-2
minutes
-1
-6
seconds
-2
-7
search
New TypeScript version has been released

TypeScript 3.9 speeds up the compiler and fixes regressions

Maika Möbus
TypeScript 3.9
© Shutterstock / giedre vaitekune

TypeScript 3.9 has arrived. If regressions that appeared in recent TypeScript versions have been keeping you from upgrading, you will be glad to hear that these issues have now been fixed. Other changes in version 3.9 include performance and editor upgrades, so let’s take a closer look.

Microsoft has released the latest language version TypeScript 3.9. The release announcement was made by Daniel Rosenwasser, Program Manager of TypeScript, and the Twitter community is excited about the new release:

SEE ALSO: Eclipse Theia and VS Code differences explained

Regression fixes

As Rosenwasser explains in the blog post, regressions regarding declarations of functions like Promise.all and Promise.race were introduced around TypeScript 3.7. This was especially the case when null or undefined values came into play, as demonstrated here:

interface Lion {
    roar(): void
}

interface Seal {
    singKissFromARose(): void
}

async function visitZoo(lionExhibit: Promise<Lion>, sealExhibit: Promise<Seal | undefined>) {
    let [lion, seal] = await Promise.all([lionExhibit, sealExhibit]);
    lion.roar(); // uh oh
//  ~~~~
// Object is possibly 'undefined'.
}

TypeScript 3.9 fixes this issue so users will no longer run into the above error. Therefore, issues around Promises should no longer be a reason to be stuck on an older version.

Speed and editor improvements

The TypeScript team has been busy working on speed improvements in different areas. For example, Microsoft teams have reported that TypeScript 3.9 reduced their compile time from 26 seconds to around 10 seconds, and the material-ui-styles project’s compile time should now be reduced by 25%.

The editor has received an upgrade as well and now supports “solution” ts.config.*.json files that exist only to manage other project files. Among other updates, the editor now also supports CommonJS-style auto-imports in JavaScript, instead of always assuming an ECMAScript-style import.

Other changes

Since the TypeScript 3.9 beta release in March, we have known that the new type operator awaited has been delayed. Originally planned for TypeScript 3.9, the feature has been pulled from the main branch until it can run smoothly. When that time has come, though, the awaited type should be able to “accurately model the way that Promise unwrapping works in JavaScript.”

SEE ALSO: VS Code 1.45 speeds up syntax highlighting and supports GitHub authentication

As we are nearing version 4.0, the plans for the upcoming version are already taking shape. See the TypeScript 4.0 Iteration Plan for more details.

The release post for TypeScript 3.9 describes all the current features.

Author
Maika Möbus
Maika Möbus has been an editor for Software & Support Media since January 2019. She studied Sociology at Goethe University Frankfurt and Johannes Gutenberg University Mainz.

Leave a Reply

avatar
400