Skip to content

v2.0.0

Compare
Choose a tag to compare
@kettanaito kettanaito released this 24 Nov 12:32
· 8 commits to main since this release

v2.0.0 (2022-11-24)

⚠️ BREAKING CHANGES

  • add deferred executor, support chaining (#4) (1fe382e)

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 any Promise.
  • 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.