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

[Feature Request]: Add promise resolving in REPL #38921

Closed
zemse opened this issue Jun 4, 2021 · 3 comments
Closed

[Feature Request]: Add promise resolving in REPL #38921

zemse opened this issue Jun 4, 2021 · 3 comments

Comments

@zemse
Copy link

zemse commented Jun 4, 2021

Description

Currently when using REPL for debugging some library's async methods is painful

> asyncTaskThatResolvesNumber();
Promise<pending>

// nodejs repl
> await asyncTaskThatResolvesNumber();
await asyncTaskThatResolvesNumber()
^^^^^

Current workaround is

> asyncTaskThatResolvesNumber().then(console.log)
123

Desired Behaviour

Chrome's console handles the case as follows.

> asyncTaskThatResolvesNumber();
Promise<pending>

// chrome console
> await asyncTaskThatResolvesNumber();
123

It'd be very helpful if we can do that in NodeJs REPL.

@zemse zemse changed the title Add promise resolving in REPL [Feature Request]: Add promise resolving in REPL Jun 4, 2021
@Ayase-252
Copy link
Member

Ayase-252 commented Jun 4, 2021

TLA in REPL has been supported experimentally behind flag --experimental-repl-await. You can enable it with node --experimental-repl-await.

Refs: https://nodejs.org/dist/latest-v16.x/docs/api/cli.html#cli_experimental_repl_await

@zemse
Copy link
Author

zemse commented Jun 5, 2021

Wow that's awesome! Thank you. So I shall close this.

Though is it known approximately until when this will stay experimental? Because it seems that it works great.

@zemse zemse closed this as completed Jun 5, 2021
@Ayase-252
Copy link
Member

@zemse

There is no ETA to unflag this right now. In the discussion on #34733, it seems still too early to unflag.

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

No branches or pull requests

2 participants