TypeScript, an extension for JavaScript that was originally developed by Microsoft but now resides on Github with a wider range of developers, was recently updated. TypeScript 1.7 brings with it support for ES6 async functions.
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:
"Aligning with ES6 allows TypeScript to become a superset of the next JavaScript, opening the way for working with new code patterns like destructuring, string templates, promises, iterators and more in addition to features TypeScript already supports, such as classes and lambda functions."
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:
"compilerOptions": {
"target": "ES6",
"module": "commonjs"
}
The compiled JavaScript output can then run in Node.js:
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. this) from a method to create fluent-style APIs. Until now, the difficulty has been in extending types, because TypeScript 'forgot' the extended types. As is explained on the TypeScript wiki:
"TypeScript now infers this to have a special type called this whenever inside an instance method of a class. The this type is written as so, and basically means "the type of the left side of the dot in a method call"."
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.
More Information
Related Articles
TypeScript Goes Light, Moves To GitHub
TypeScript Fully Accepted into Visual Studio
Getting Started With TypeScript
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, Google+ or Linkedin.
.NET 10, C# 14 and F# 10 Released Alongside Visual Studio 2026
13/11/2025
Microsoft has shipped .NET 10, the platform created from a combination of .NET Framework and .NET Core, including C# 14 and F# 10. Visual Studio 2026 has also been released at .NET Conf, the onli [ ... ]
AI Champion Ship Now Open
07/11/2025
The AI Champion Ship is now underway, with a month to go before entries close. The organizers describe it as a global competition for builders, dreamers, and tinkerers who want to push AI beyond the o [ ... ]
- Linkerd Adds MCP Support
- XAML.io 0.5 Adds Multi-File Project Editing
- GitHub Announces Agent HQ Organizer
- Edera Open Sources Sprout
- Qodana Revisited
- GitHub Copilot CLI And Spaces In Preview
- Robot Army Video As Robots Shipped En Masse
- Vibe Coding Is Collins Word of the Year 2025
- Robotic Gut Spider For Exploring Digestive Tract
- The Fuss About Fil-C...
- Next.js 16 Adds Cache Components
- Formae Launched As Terraform Alternative
- Apache Grails 7.0 Released
Comments
or email your comment to: comments@i-programmer.info