Skip to content

AsyncResource constructor arguments #46369

Open
@jasnell

Description

@jasnell

Currently, the AsyncResource constructor requires a type argument, e.g. new AsyncResource('foo'). It will throw if this is not provided. This information, however, is only used for async_hooks integration and is not necessary for async context propagation. I'd like to propose that we make the argument optional, defaulting its value to this.constructor?.name || 'AsyncResource' when it is not provided.

/cc @Qard @legendecas @nodejs/async_hooks

Metadata

Metadata

Assignees

No one assigned

    Labels

    async_hooksIssues and PRs related to the async hooks subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions