Skip to content

[3.8] [BUG] TLA top-level await breaks with parenthesis #36817

Closed
@trusktr

Description

@trusktr

TypeScript Version: 3.8.1-rc

Search Terms:

Code

// works:
const DBService = await import('./DBService')
await DBService.start()

// doesn't work
await (await import('./DBService')).start()
await (1 + 1)

// works:
async function foo() {
    await (await import('./DBService')).start()
}

export {}

Expected behavior:

no error on the await word

Actual behavior:

TS thinks it is an identifier.

Playground Link:

Playground link

Related Issues:

#35276

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions