Skip to content

fix: assimilate PromiseLike inputs in fromPromise - #686

Open
lfhwnqe wants to merge 2 commits into
supermacro:masterfrom
lfhwnqe:fix/assimilate-promise-like-inputs
Open

lfhwnqe wants to merge 2 commits into
supermacro:masterfrom
lfhwnqe:fix/assimilate-promise-like-inputs

Conversation

@lfhwnqe

@lfhwnqe lfhwnqe commented Nov 5, 2026

Copy link
Copy Markdown

ResultAsync.fromPromise accepts PromiseLike<T>, but calls .catch() on the return value of .then(). A compliant thenable without .catch() therefore throws before producing a ResultAsync.

Assimilate the input with Promise.resolve before chaining handlers. The regression covers both fulfillment and rejection of a thenable whose then returns another PromiseLike.

Fixes #643.

Validation: the regression fails before the fix with promise.then(...).catch is not a function. Afterward, npm test passes 118 runtime tests plus the type tests; npm run typecheck, npm run lint, the changed-file Prettier check, and npm run build pass.

AI assistance: this change and its regression tests were developed with OpenAI Codex. The listed checks were run locally.

@changeset-bot

changeset-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: aaf7aeb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
neverthrow Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
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.

[BUG] ResultAsync.fromPromise fails with React 19 server components' Promise transmission

1 participant