Skip to content

can't use top-level await in projects where you set es2020 or something #8435

Open
@karl-police

Description

@karl-police

🐛 bug report

Preflight Checklist

  • I have read the [Contributing Guidelines][contributing] for this project.
  • I agree to follow the [Code of Conduct][code_of_conduct] that this project
    adheres to.
  • I have searched the issue tracker for an issue that matches the one I want
    to file, without success.

Description of the problem

I can't use await

e.g. if you open the Browser console you can do something pointless like await console.log("HI") and it won't throw an error.
On Codesandbox you can't.

 

Similar to #8433 except that it's for top-level await.

To Reproduce

https://codesandbox.io/p/sandbox/hungry-forest-forked-3ssrkq?file=%2Fsrc%2Findex.ts

https://codesandbox.io/p/sandbox/codesandbox-github-async-await-issue-7hpwm8

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