TypeScript: cannot find name async/await TypeScript: cannot find name async/await typescript typescript

TypeScript: cannot find name async/await


You need to use your asyncFn inside a function marked as an 'async' function. For example:

async someAsyncCode() {    let asyncFn = () => {        return new Promise((resolve: Function) => { resolve(2); });    }    // should log `2`    console.log(await asyncFn());}