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
createDeferredExecutorto 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
resolvedpromise state is replaced by
fulfilled, which is the correct promise state representation per
specification.