Our Blogs

TypeScript 2.1 released with new features

December 26, 2016
custom software developmentMicrosoft has released TypeScript 2.1, which brings in a wide range of features to not only reduce unnecessary typing but also streamline the toolchain. The previous release only provided support for async/await. However, it was only when it targeted ES2015.

With the launch of TypeScript 2.1, developers will be able to emit async/await into ES3/ES5 level code. Hence, you need not have to work with an additional transpiler  to convert the code into a usable state for all web browsers.

If you are TypeScript developer who work in React, the absence of the spread operator means that you either need to modify code or add in Babel to handle the operator properly. If you look at the React, the spread operator is used to pass properties to a downlevel component. In version prior to TypeScript 2.1, you need to add Babel to successfully handle the transform.
Commenting on the launch, TypeScript Program Manager Daniel Rosenwasser disclosed that when they implement a feature in TypeScript, we take lengths to ensure that it is typed appropriately. Moreover, few steps are taken to make sure that its performance characteristics are reasonable. This mean when you work with object rest/spread, it is not necessary to just ship an experience where type is effectively any, leading users to be frustrated if they make an error. 

In case of async/await, you need to rewrite the entire emit pipeline. The latest version avoids this route. Hence, you will be able to compile easily. 

TypeScript 2.1 also brings in several new features such as keyof operator, easier imports, and mapped types. The mapped types is the most interesting feature in the new release, adds Rosenwasser. It saves developers from the need for an entirely new variants of existing objects. This is when the properties are mostly the same. According to Rosenwasser, the new release implements a flexible solution when it comes on improving the imports experience.