Skip to content

Support for ES2026 using and await using declarations #19792

@ota-meshi

Description

@ota-meshi

Syntax name

Explicit Resource Management

Syntax proposal URL

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

Example code

// sync disposal
function * g() {
  using handle = acquireFileHandle(); // block-scoped critical resource
} // cleanup

{
  using obj = g(); // block-scoped declaration
  const r = obj.next();
} // calls finally blocks in `g`

// async disposal
async function * g() {
  using stream = acquireStream(); // block-scoped critical resource
  ...
} // cleanup

{
  await using obj = g(); // block-scoped declaration
  const r = await obj.next();
} // calls finally blocks in `g`

Implementation Checklist

Participation

  • I am willing to submit a pull request for this change.

Additional comments

The specifications can be found at the following link:

tc39/ecma262#3000
https://arai-a.github.io/ecma262-compare/?pr=3000

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusioncoreRelates to ESLint's core APIs and featuresnew syntaxThis issue is related to new syntax that has reached stage 4

    Type

    No type

    Projects

    Status

    Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions