|Written by Kay Ewbank|
|Monday, 14 December 2015|
The support for async functions for ECMAScript 6 (ES6) is part of a long-standing drive to align TypeScript with ES6. In a post back in 2014 on the TypeScript blog, Jonathan Turner said that:
The TypeScript roadmap shows that the developers are planning to add async/await support for ES3 and ES5 by version 2.0. The async support is enabled by default, and should widen the usability of TypeScript as it means ES6 generators such as node.js v4 and above will be able to make use of asynchronous methods without having to wait for the operations to complete.
If you set up your tsconfig.json like this:
In addition to the async support, the new version adds support for polymorphic 'this' typing. The feature has been added to make TypeScript offer better support for the sort of coding where you want to return the current object (i.e.
"TypeScript now infers
Adding the support has meant TypeScript 1.7 has made changes in inferring the type from 'this', which means some code could be broken. In a class, the type of the value this will be inferred to the this type, and subsequent assignments from values of the original type can fail. There's a code sample with the recommended work around, along with a list of other potentially breaking changes, on GitHub.
The final major improvement is the addition of the exponentiation operator. The ECMAScript committee recently moved this to stage 3, so the TypeScript developers decided it was ready for TypeScript to adopt, and added support for it in TypeScript 1.7, meaning you'll be able to use the ** and **= operators for raising to a power.
The new version is available on Github.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Monday, 14 December 2015 )|