Back to Explore

open-draft/deferred-promise

GitHub
1 watchersOpen source

Last release:

@open-draft/deferred-promise provides a Promise-compatible `DeferredPromise` (and `createDeferredExecutor`) that lets you create a promise upfront and resolve or reject it later from another part of your system. It is useful when one module needs to return a promise immediately while a different module fulfills the result, similar to Node.js deferred utilities but without creating nested promise instances.

Project status

  • Actively maintained? Yes. The most recent upstream update was on 2026-03-24, and v3.0.0 was published immediately after that, indicating ongoing maintenance as of 2026-06-11.
  • Update cadence (apparent): There was a long gap from v2.2.0 (2023-09-07) to v3.0.0 (2026-03-24), then a newer update appears within the last few months. This suggests an evolving library with bursty releases rather than a steady monthly cadence.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v3.0.0

    v3.0.0 migrates the package to ESM and updates the toolchain and dependencies. The codebase also refactors the public entrypoint exports for `DeferredPromise` and its deferred executor helpers.

    Breaking
  • v2.2.0

    v2.2.0 adds ESM support for @open-draft/deferred-promise and updates the package build/publish setup. The release notes mention ESM support, but the diff shows broader packaging and tooling changes that can affect consumer import behavior and build outputs.

    BreakingFeatures
  • v2.1.0

    v2.1.0 focuses on improving Promise compatibility. The code changes indicate a significant internal refactor around how DeferredPromise is implemented, how resolution/rejection is scheduled, and how promise state is tracked across then/catch/finally chains.

    Features
  • v2.0.0

    v2.0.0 refactors the library to implement DeferredPromise behavior using a new deferred executor abstraction. It adds Promise chaining support, introduces `createDeferredExecutor()`, and updates types and state naming so awaiting the promise replaces using `DeferredPromise.result`, and `resolved` becomes `fulfilled`.

    BreakingFeatures
  • v1.3.0

    v1.3.0 changes DeferredPromise behavior so that calling resolve/reject after the promise has already settled no longer throws an error. The IllegalStateError type and its public export were removed, and the test suite was updated accordingly.

    BreakingFeatures
  • v1.2.1

    v1.2.1 makes the IllegalStateError class assign a specific error name, improving how it matches in instanceof-style checks and test assertions. The main runtime change is in src/IllegalStateError.ts, with accompanying test updates to validate error message and state behavior.

  • v1.2.0

    v1.2.0 adds a dedicated IllegalStateError and updates DeferredPromise to throw it when resolve or reject is called after the promise is no longer in the pending state. The change also exports IllegalStateError from the package entrypoint and updates tests accordingly.

    BreakingFeatures
  • v1.1.1

    v1.1.1 focuses on making DeferredPromise chaining more compatible with Promise semantics. The code changes are primarily TypeScript typing updates for resolve/reject callback return types and for the generic return types of then/catch/finally, plus corresponding test and README updates.

    Breaking
  • v1.1.0

    Release v1.1.0 documents a single new feature: support for DeferredPromise.prototype.finally(). The code diff, however, shows additional behavioral and type changes around how then() and catch() interact with the internal promise and how DeferredPromise is typed by default.

    Features
  • v1.0.0

    v1.0.0 is the first release of this package. The notes call out a breaking change related to the introduction of an initial DeferredPromise implementation.

    Breaking