December 2017
Beginner
372 pages
10h 32m
English
TypeScript introduced async-await in the 1.7.x version, but it was only available if your compiler version was ES2015. In the 2.x version, they made it backward-compatible to support ES5 and ES3 JavaScript versions as well.
In TypeScript async-await is built on top of promises and allows us to write asynchronous code in more linear fashion. The main advantage of async-await is that it provides developers with a way to write code, which is similar to writing synchronous code, thus providing better readability and cleaner code.
Let's look at the sample async-await code and go through the differences with promises:
async function callAsyncFunction(id:number) { console.log("before making a async call"); await doAsyncWork(id); console ...
Read now
Unlock full access