-
Notifications
You must be signed in to change notification settings - Fork 30k
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
[REPL] Cannot declare variables under strict-mode when used along --experimental-top-level-await #39259
Comments
We should be declaring @ejose19 is this something you might be able to contribute to here? It is also a blocker for #39142. |
The tests for this are in https://github.com/nodejs/node/blob/master/test/parallel/test-repl-preprocess-top-level-await.js#L62. The suggested change is the following to the last test case:
->
|
@guybedford Sure, this is also needed for |
@guybedford I've submitted a PR, let me know what you think. |
Fixed in #39265. |
What steps will reproduce the bug?
node --use_strict --experimental-repl-await
const x = await 1;
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior?
It shouldn't throw error, or if this is not supported then it should error out before starting repl.
What do you see instead?
Error is thrown
Additional information
This is related to handling in
node/lib/internal/repl/await.js
Lines 53 to 74 in c2e6822
as it's replacing
const
withvoid ($exp)
without any flag to omit if running in strict mode.This was noticed when trying to implement TLA in repl for ts-node.
The text was updated successfully, but these errors were encountered: