Skip to content

Incorrect lexing of TLA await in try...catch #38483

Closed
@kitsonk

Description

@kitsonk

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

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions