neverthrow icon indicating copy to clipboard operation
neverthrow copied to clipboard

Fix `map` and `mapErr` types

Open rijenkii opened this issue 8 months ago • 1 comments

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>

rijenkii avatar Apr 07 '25 11:04 rijenkii