TypeScript 4 Released
Written by Ian Elliot   
Friday, 21 August 2020

TypeScript 4.0 has been released with improvements to the build and editing processes, along with support for variadic tuple types. TypeScript is a superset of JavaScript that adds optional static types which can be checked by the TypeScript compiler to catch common errors in your programs.

Shortly after the launch of a new website for TypeScript comes the release of a new major update. One of the main changes to the new release is support for Variadic Tuple types.Standard TypeScript tuples are types that works like arrays with a fixed number of elements of known types.


Variadic tuples can be used to define a tuple type that has the same properties — defined length and the type of each element is known — but where the exact shape is yet to be defined. Using variadic tuples means you can use the rest operator to pass types through the type checker in a way that works like generics.

In addition, spreads in tuple type syntax can now be generic. This makes it possible to represent higher-order operations on tuples and arrays even when the actual types being operating over aren't known. When generic spreads are instantiated or replaced with a real type, they can produce other sets of array and tuple types. More generally with tuples, you can now have labelled tuple elements to make code more readable.

Other improvements include support for class property inference from constructors, meaning TypeScript can now use control flow analysis to determine the types of properties in classes when noImplicitAny is enabled.

Three new compound assignment operator is have also been added. Compound assignment operators apply an operator to two arguments, and then assign the result to the left side, but until now JavaScript lacked support for logical and (&&), logical or (||), and nullish coalescing (??). TypeScript has added support for a new ECMAScript feature to add three new assignment operators: &&=, ||=, and ??=.

Support has also been added for custom JSX factories. JSX uses fragments, a type of JSX element that can return multiple child elements. TypeScript's support for this wasn't the same as in other libraries, so TypeScript 4 has changed its technique so users can customize the fragment factory through the new jsxFragmentFactory option.



  • Ian Elliot is the author of several JavaScript titles. Just JavaScript: An Idiomatic Approach is intended for programmers who are familiar with another language, and which takes a radical look at JavaScript that takes account of the way it is object-based. JavaScript Async covers asynchronous programming in JavaScript, async/await, Promises, Service Workers and so on.  His latest book, JavaScript Bitmap Graphics with Canvas shows you how to use Canvas to create graphics without resorting to a library of any kind.



More Information

TypeScript On NuGet

TypeScript On GitHub

Related Articles

New TypeScript Website Launched

TypeScript 3.6 Generators Get Stricter

TypeScript 3.5 Adds Smart Select 

TypeScript 3.2 Gets Stricter Checking

TypeScript 3.1 Adds Mappable Tuples

TypeScript 3.0 Adds Project References 


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


Udacity Launches All Access Subscription Model

To help learners advance and expand their skill sets, online learning provider Udacity is switching to a new subscription model that provides unlimited access to its entire catalog.

Kotlin Re-Enters TIOBE Index Top 20

Kotlin, the open-source Java alternative from JetBrains, is back in the Top 20 of the TIOBE Index, displacing Julia which lost the 20th position after only one month and is now down at 25th place.

More News

Summer SALE Kindle 9.99 Paperback $10 off!!




or email your comment to: comments@i-programmer.info