TypeScript 3.9 speeds up the compiler and fixes regressions

Share

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.

Source : JAXenter