Skip to content

support using / await using (explicit resource management) #19569

Description

@ShenHongFei

Feature request

What is the expected behavior?

{
    using resource = {
        [Symbol.dispose] () {
            console.log('dispose')
        }
    }
}
// output: dispose

What is motivation or use case for adding/changing the behavior?
Node.js and browsers already natively support and can use this syntax.

https://v8.dev/features/explicit-resource-management

https://github.com/tc39/proposal-explicit-resource-management

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html

nodejs/node#58467

How should this be implemented in your opinion?
parse this code correctly
acornjs/acorn#1367

Are you willing to work on this yourself?
maybe

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions