How does the async/await syntax work in TypeScript?
The key is to use an ES6 Promise or something that implements the PromiseLike and PromiseConstructorLike interfaces found in lib.d.ts (Read more). A jQuery promise does not implement these interfaces so it won’t work with that. Here’s a simple example using an ES6 promise: function getStringFromWebServerAsync(url: string) { return new Promise<string>((resolve, reject) => { // … Read more