Skip to content

Top level await breaks with parentheses #35276

Closed
@kevinkassimo

Description

@kevinkassimo

TypeScript Version: 3.7.2

Search Terms: Top

Code

const v = await (1);

Expected behavior:
No error thrown. (If renaming this file to .js extension, it would be accepted by runtimes that enables top-level await e.g. Deno, indicating this is accepted by engines like V8)

Actual behavior:

error TS2304: Cannot find name 'await'.

► file:///Users/kun/Projects/Deno/test/tla.ts:5:11

5 const v = await (1);
            ~~~~~

Playground Link: Not available

Related Issues: Not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions