镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Description

@zemse

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.

Activity

  1. changed the title [-]Add promise resolving in REPL[/-] [+][Feature Request]: Add promise resolving in REPL[/+] on Jun 4, 2021
  2. Ayase-252 commented on Jun 4, 2021

    @Ayase-252
    Member

    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

  3. zemse commented on Jun 5, 2021

    @zemse
    Author

    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.

  4. Ayase-252 commented on Jun 5, 2021

    @Ayase-252
    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

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