For writing a JavaScript, you need a Web browser and either a text editor or an HTML editor. When you have them all, in place, you can begin writing JavaScript code. Writing JavaScript, however, could be made more structured and object-oriented with TypeScript. It is a static typed language that compiles to plain JavaScript. The good news is, the latest version of this tool – TypeScript 3.4 is now available.
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.