Microsoft announced the availability of the latest stable version of its programming language, TypeScript 4.0 and as the next generation of TypeScript releases, with focus on expressivity, productivity, and scalability.
What's New in TypeScript 4.0?
It brings two fundamental changes, along with inference improvements to make typing easier. The first change is the fact that spreads in tuple type syntax is now generic, which means that users can represent higher-order operations on tuples and arrays even when they don’t know the actual types operating over.
And if generic spreads are instantiated (or, replaced with a real type) in the tuple types, they can produce other sets of array and tuple types. You can find all the major new features and changes in TypeScript 4.0 below:
- Custom JSX Factories
- Labeled Tuple Elements
- Short-Circuiting Assignment Operators
- Class Property Inference from Constructors
- Unknown on catch Clauses
Additionally, TypeScript 4.0 changes the outcome of compiling a program after a previous compile with errors under --incremental, which would previously be extremely slow when using the --noEmitOnError flag, because of none of the information from the last compilation would be cached in a .tsbuildinfo file based on the --noEmitOnError flag.
Now, it gives a great speed boost in the above scenarios, improving --build mode scenarios (which imply both --incremental and --noEmitOnError).
Getting started with TypeScript 4.0
If you want to get started in using TypeScript 4.0, you should install it via NuGet or NPM:
npm i typescript
Also, you can test code using the TypeScript playground or any text editor that supports TypeScript, such as Visual Studio Code. And the official instructions for using TypeScript in Visual Studio Code is available here!