TypeScript 4.0 Is Out

TypeScript 4.0 addresses slow startup and brings way smarter auto-imports.

Recently, TypeScript Team announced the availability of TypeScript 4.0, which is a major milestone with a host of new features.
 
Source: Microsoft
 
Let's see what's new in 4.0
  • Variadic Tuple Types
  • Labeled Tuple Elements
  • Short-Circuiting Assignment Operators
  • Class Property Inference from Constructors
  • Custom JSX Factories
  • unknown on catch Clauses
  • Speed Improvements in build mode with --noEmitOnError
  • --incremental with --noEmit
  • Editor Improvements including Convert to Optional Chaining, /** @deprecated */ Support, Partial Semantic Mode at Startup, Smarter Auto-Imports
You can now represent higher-order operations on tuples and arrays even when if you don’t know the actual types you are operating over. When generic spreads are instantiated in these tuple types, they can produce other sets of array and tuple types. Another change is that spread elements can now occur anywhere in a tuple, not just at the end.
 
In TypeScript 4.0, tuples types can now provide labels as well. Labeled tuples can be handy when taking advantage of patterns around tuples and argument lists, along with implementing overloads in a type-safe way
 
TypeScript 4.0 RC enables you to use control flow analysis to determine the types of properties in classes when noImplicitAny is enabled. When not all paths of a constructor assign to an instance member, the property will be considered to potentially be undefined. And if you know better (for example you have an initialize method of some sort), you’ll require an explicit type annotation along with a definite assignment assertion (!) if you’re in strictPropertyInitialization.
 
The release is also bringing a new refactoring to convert common patterns in order to take advantage of optional chaining and nullish coalescing.
 
You can visit the official announcement here.


Next Recommended Reading TypeScript 4.0 RC Is Now Available