Skip to content

Accept PromiseLike values in call() and until() - #1231

Merged
cowboyd merged 1 commit into
thefrontside:v4from
jrandolf:accept-promise-like
Sep 1, 2026
Merged

Accept PromiseLike values in call() and until()#1231
cowboyd merged 1 commit into
thefrontside:v4from
jrandolf:accept-promise-like

Conversation

@jrandolf

@jrandolf jrandolf commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Motivation

call() and until() only consume thenables, but their public types require full Promise implementations. This rejects valid PromiseLike values, and until() also calls .catch(), which is not part of the PromiseLike contract.

Approach

  • Accept PromiseLike values in Callable, call(), and until().
  • Pass the rejection handler directly to .then() so until() uses only the PromiseLike interface.
  • Cover both APIs with promise-like regression tests.

@pkg-pr-new

pkg-pr-new Bot commented Sep 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/effection@1231

commit: cbd8301

@codspeed-hq

codspeed-hq Bot commented Sep 1, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing jrandolf:accept-promise-like (cbd8301) with v4 (9092672)

Open in CodSpeed

@cowboyd cowboyd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is a merge conflict, but otherwise great! Thanks 🎉

@cowboyd cowboyd changed the title 🐛 Accept PromiseLike values in call() and until() Accept PromiseLike values in call() and until() Sep 1, 2026
@jrandolf

jrandolf commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

The Windows failure looks transient and unrelated to this PR: it failed in race() ... rejects when one of the given operations rejects asynchronously first, while both new call()/until() tests passed. The same 90926724 base commit passed Windows on v4 and in #1230. I don't have permission to rerun the failed Actions job; could a maintainer rerun it?

@cowboyd
cowboyd merged commit 34b8ebe into thefrontside:v4 Sep 1, 2026
23 of 25 checks passed
@jrandolf
jrandolf deleted the accept-promise-like branch September 1, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants