TypeScript Version: 3.8.3
Search Terms: top level await, try catch
Code
try {
await (async () => {})(); // TS2304 cannot find name 'await'
} catch {
//
}
Expected behavior:
The file is considered valid.
Actual behavior:
The file has an error at await of "TS2304 cannot find name 'await'".
Playground Link: https://www.typescriptlang.org/play?#code/C4JwngBA3gUAkAQwO4IJbAgCgQZzAOwGMsBKCAXgD5oBfEzEgbhhokIWEIAtp4B6PixhA
Hi,
This seems to be a problem with all the top level statements of the form await (async () => { ... })() and not only in try...catch.
I'm gonna work on it.
Most helpful comment
Hi,
This seems to be a problem with all the top level statements of the form
await (async () => { ... })()and not only in try...catch.I'm gonna work on it.