Skip to content

Make the API disposable - #64117

Merged
Wesley Wigham (weswigham) merged 2 commits into
microsoft:mainfrom
weswigham:disposable-api
Sep 2, 2026
Merged

Make the API disposable#64117
Wesley Wigham (weswigham) merged 2 commits into
microsoft:mainfrom
weswigham:disposable-api

Conversation

@weswigham

Copy link
Copy Markdown
Member

Adds a Symbol.asyncDispose/Symbol.dispose onto the API, so you can await using/using it to manage its' lifetime lexically.

I also had to include basically all the disposal/initialization race condition fixes I've been picking into my other recent API PRs here, too.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds lexical lifetime management to the TypeScript API and hardens initialization/disposal races.

Changes:

  • Adds synchronous and asynchronous disposal symbols.
  • Deduplicates initialization and disposal operations.
  • Updates sync generation and benchmark cleanup.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/typescript/src/api/async/api.ts Adds async disposal and lifecycle guards.
packages/typescript/src/api/async/client.ts Tracks connection and closed states.
packages/typescript/src/api/sync/api.ts Provides generated synchronous disposal behavior.
packages/typescript/scripts/generateSync.ts Converts await using into using.
packages/typescript/test/async/api.bench.ts Tears down async benchmark resources.
packages/typescript/test/sync/api.bench.ts Tears down sync benchmark resources.
packages/typescript/test/sync/api-generators.test.ts Exempts new private generator helpers.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/typescript/src/api/async/client.ts
Comment thread packages/typescript/src/api/async/api.ts
Comment thread packages/typescript/src/api/sync/api.ts
@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Sep 1, 2026
@weswigham
Wesley Wigham (weswigham) added this pull request to the merge queue Sep 2, 2026
Merged via the queue into microsoft:main with commit 43a90f4 Sep 2, 2026
26 checks passed
@weswigham
Wesley Wigham (weswigham) deleted the disposable-api branch September 2, 2026 05:03
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants