Skip to content

Fix map and mapErr types #634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

rijenkii
Copy link

@rijenkii rijenkii commented Apr 7, 2025

Fixes #616.

Currently functions map and mapErr cannot receive callbacks that return type A | Promise<B>, because the callback is expected to have return type A | Promise<A>.

This PR fixes this, basically changing function signatures from

<A,>(cb: () => A | Promise<A>): A
<A,>(cb: () => A): Awaited<A>

Copy link

changeset-bot bot commented Apr 7, 2025

🦋 Changeset detected

Latest commit: 369b00c

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

Copy link
Contributor

@macksal macksal left a comment

Choose a reason for hiding this comment

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

LGTM. Hope the maintainers come across this

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.

Improve ResultAsync.map* method types
2 participants