Releases: open-draft/deferred-promise
Releases · open-draft/deferred-promise
v2.2.0
v2.1.0
v2.0.0
v2.0.0 (2022-11-24)
⚠️ BREAKING CHANGES
Deferred promises are now implemented via the deferred
executor function. There are no changes to the existing public API.
Changes
- Supports Promise chaining.
- Adds
createDeferredExecutor
to use this library with anyPromise
. - Improves type annotations in regard to what the deferred promise
expects as the input and what is the promise's output:
const p = new DeferredPromise<number>()
.then(() => 'hello')
// The input must be "number".
p.resolve(5)
// the output is "string"
// (the result of the "then" chain)
await p // "hello"
- Deprecated: Removes
DeferredPromise.result
. Access the result by
awaiting the promise instead. - Deprecated: The
resolved
promise state is replaced by
fulfilled
, which is the correct promise state representation per
specification.