Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING(async): deprecate deferred() in favor of Promise.withResolvers() #3758

Merged
merged 13 commits into from
Nov 10, 2023
4 changes: 4 additions & 0 deletions async/deferred.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// typescript produces broken code when targeting ES5 code.
// See https://github.com/Microsoft/TypeScript/issues/15202
// At the time of writing, the github issue is closed but the problem remains.

/** @deprecated (will be removed in 0.209.0) Use {@linkcode Promise.withResolvers} instead. */
export interface Deferred<T> extends Promise<T> {
readonly state: "pending" | "fulfilled" | "rejected";
resolve(value?: T | PromiseLike<T>): void;
Expand All @@ -14,6 +16,8 @@ export interface Deferred<T> extends Promise<T> {
}

/**
* @deprecated (will be removed in 0.209.0) Use {@linkcode Promise.withResolvers} instead.
*
* Creates a Promise with the `reject` and `resolve` functions placed as methods
* on the promise object itself.
*
Expand Down