Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unxepcted identifier, expected the token ;" when using await inside of ES module #9102

Open
DanielBaulig opened this issue Oct 29, 2023 · 3 comments

Comments

@DanielBaulig
Copy link
Contributor

DanielBaulig commented Oct 29, 2023

When using await at the top level of an ES module flow flags that as an invalid use of await. I tried naming the file x.js as well as x.jsm and x.mjs and included an export statement to indicate that it's a ES module, without success. I searched the flow documentation for anything relating to module, es module and await, but didn't find anything relevant.

Flow version: v0.220.0

Expected behavior

Pass the type check.

According to MDN await is legal at the top level of a module.

Actual behavior

Error: Unexpected identifier, expected the token ;

@DanielBaulig DanielBaulig changed the title "Unxepcted identifier, expected the token ;" when using await inside of ES Module "Unxepcted identifier, expected the token ;" when using await inside of ES module Oct 29, 2023
@DanielBaulig
Copy link
Contributor Author

Found a bug report from 2019 (!) on this:
#7710

:-/

@gkz
Copy link
Member

gkz commented Oct 30, 2023

We don't currently support top-level await, but it's on the backlog of items to do

@DanielBaulig
Copy link
Contributor Author

That's sad to hear. Is there a timeline for when we can expect support for top-level await to land in Flow? I'm starting a new project and might consider trying out TS, since I believe it does support top-level await. I'd prefer to stick with Flow if I can though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants