Skip to content

Top level await breaks with parentheses #35276

Description

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

Activity

  1. kevinkassimo commented on Nov 21, 2019

    @kevinkassimo
    Author

    Sorry, I thought 3.7 turns on top-level await support. Turns out Deno turns off top-level await warnings ourselves and TLA support for TS is not fully completed yet

  2. j-oliveras commented on Nov 21, 2019

    @j-oliveras
    Contributor

    As a reference, #25988 tracks adding top level await. Currently planed for 3.8.

  3. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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