09/07/2020

Ottoboni-Computer

We Fix IT!

TypeScript 3.8 adds type-only imports and exports

TypeScript 3.eight, a new version of Microsoft’s typed superset of JavaScript, is now out there as a creation release. The latest TypeScript update emphasizes kind-only imports and exports and ECMAScript requirements compliance.

The release adds a new syntax for kind-only imports and exports, with the intent of offering people additional fantastic-grained command in excess of import and elision. The import kind syntax only imports declarations to be utilized for kind annotations and declarations and often will get absolutely erased. The export kind syntax only gives an export to be utilized for kind contexts and is erased from TypeScript output.

TypeScript has utilized JavaScript’s import syntax to allow reference forms. Even though convenient, the capacity only worked because of the import elision function, which omits TypeScript kind imports when TypeScript outputs JavaScript documents. However, import elision has been both insufficient and problematic.

In conjunction with import kind, TypeScript 3.eight also adds a compiler flag to command what transpires with imports that will not be utilized at runtime: importsNotUsedAsValues.

Pertaining to the ECMAScript standard for JavaScript, TypeScript 3.eight adds help for ECMAScript private fields, which is element of a course fields declaration proposal for JavaScript. General public and private fields will be built-in into one, orthogonal whole, according to this proposal.

Other advancements promised in TypeScript 3.eight contain: