Today we’re happy to announce the availability of TypeScript 3.4! TypeScript 3.4 introduces a new flag called –incremental which tells TypeScript to save information about the project graph from the last compilation. The next time TypeScript is invoked with –incremental, it will use that information to detect the least costly way to type-check and emit changes to your project, writes Daniel in a blog post.
TypeScript 3.4 arrives with new features
TypeScript 3.4 brings some important updates and interesting new features like
- A new flag called – incremental
- Higher order type inference from generic functions
- Improvements for ReadonlyArray and readonly tuples
- const assertions
- Type-checking for globalThis.
1] Faster subsequent builds with the –-incremental flag
It tells TypeScript to save information about the project graph from the last compilation. In an experiment it was found that for a project the size of Visual Studio Code, TypeScript’s new —incremental flag was able to reduce subsequent build times down to approximately a fifth of the original.
2] Higher order type inference from generic functions
During type argument inference for a call to a generic function that returns a function type, TypeScript will, as appropriate, propagate type parameters from generic function arguments onto the resulting function type.
3] Improvements for ReadonlyArray and readonly tuples
The newer version makes it somewhat easier to use read-only array-like types. Also, a new syntax for ReadonlyArray describes Arrays that can only be read from. Any variable with a reference to a ReadonlyArray can’t add, remove, or replace any elements of the array.
4] Const Assertions
The new assertion favor immutability in the types inferred for literal expressions
5] Type-checking for globalThis
The new addition tries to offer standard way for accessing the global scope which can be used across different environments.
For more information, visit Microsoft Blog.