TypeScript 3.8 adds type-only imports and exports

TypeScript three.8, a new version of Microsoft’s typed superset of JavaScript, is now accessible as

TypeScript three.8, a new version of Microsoft’s typed superset of JavaScript, is now accessible as a generation launch. The latest TypeScript up grade emphasizes type-only imports and exports and ECMAScript criteria compliance.

The launch adds a new syntax for type-only imports and exports, with the intent of giving buyers additional good-grained command around import and elision. The import type syntax only imports declarations to be applied for type annotations and declarations and always gets completely erased. The export type syntax only gives an export to be applied for type contexts and is erased from TypeScript output.

TypeScript has applied JavaScript’s import syntax to help reference sorts. Even though easy, the capacity only labored because of the import elision attribute, which omits TypeScript type imports when TypeScript outputs JavaScript information. On the other hand, import elision has been both insufficient and problematic.

In conjunction with import type, TypeScript three.8 also adds a compiler flag to command what happens with imports that will not be applied at runtime: importsNotUsedAsValues.

Relating to the ECMAScript regular for JavaScript, TypeScript three.8 adds guidance for ECMAScript non-public fields, which is aspect of a course fields declaration proposal for JavaScript. Community and non-public fields will be built-in into single, orthogonal whole, in accordance to this proposal.

Other improvements promised in TypeScript three.8 include: