TypeScript 3.8 adds type-only imports and exports

TypeScript 3.8, a new variation 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 giving end users far more fantastic-grained manage about import and elision. The import kind syntax only imports declarations to be used for kind annotations and declarations and generally receives totally erased. The export kind syntax only offers an export to be used for kind contexts and is erased from TypeScript output.

TypeScript has used JavaScript’s import syntax to permit reference forms. Although practical, the capacity only worked since of the import elision feature, which omits TypeScript kind imports when TypeScript outputs JavaScript data files. Even so, import elision has been both insufficient and problematic.

In conjunction with import kind, TypeScript 3.8 also adds a compiler flag to manage what occurs with imports that won’t be used at runtime: importsNotUsedAsValues.

Regarding the ECMAScript conventional for JavaScript, TypeScript 3.8 adds assistance for ECMAScript personal fields, which is portion of a class fields declaration proposal for JavaScript. Community and personal fields will be integrated into one, orthogonal full, in accordance to this proposal.

Other advancements promised in TypeScript 3.8 consist of: