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.
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:
Other improvements promised in TypeScript three.8 include:
- “Fast and loose” incremental type-examining, that includes a compiler choice,
assumeChangesOnlyAffectDirectDependencies. This choice can cut down construct periods in certain information, as TypeScript will recheck/rebuild only information that have changed as perfectly as information that right import them. It is advisable for significant code bases where developers are keen to defer total project faults right until a afterwards time.
- Implementation of the export as
* nssyntax, furnishing a single entry point to expose all associates of one more module as a single member.
await, an approaching ECMAScript attribute to take out limits on using an
awaitexpression at the prime of a file under distinct problems.
allowJsflag type-examining of these information is supported by using the
jsconfig.jsonallows buyers explain to the compiler/language service which file watching techniques to use to keep observe of information and directories.
- A refactoring to change string concatenations.
- Stricter assignability checks to unions with index signatures, a breaking change.
- In one more breaking change,
itemin JSDoc is no lengthier
You can put in the basic launch of TypeScript three.8 as a result of NuGet or by using NPM:
npm put in typescript