-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Top level await breaks on parentheses #3391
Comments
This seems to be TS only. JS works fine Looks like we have to wait for TypeScript 3.8 to get full support from TS on TLA |
Agreed, we can't just safely ignore |
We just have to wait for TS to fix it. |
kitsonk
added a commit
to kitsonk/deno
that referenced
this issue
Feb 24, 2020
In regards to top-level-await, TypeScript will throw if the input does not look like a module (as top-level-await is not supported in scripts). TypeScript recommends adding `export {};` to the file, which is the current idomatic way of identifying a module as a module that otherwise has no imports or exports. Resolves denoland#3937 Resolves denoland#3301 Resolves denoland#3391
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is fine:
This is not:
It exits with:
error TS2304: Cannot find name 'await'.
The above is the most minimal example that shows this.
More realistic use case - if I have a promise
p
like this:I cannot get to the value
1
in one step:It exits with:
error TS2304: Cannot find name 'await'.
I have to do it in two steps:
I suppose that those are the parentheses (maybe the compiler thinks it is a function call?) but I can be wrong here.
The text was updated successfully, but these errors were encountered: