Releases: supermacro/neverthrow
Fix superflouous logging
2.3.2
New `ResultAsync` API
The 2.3.0
release introduces a brand new ResultAsync
API!
Thank you to @paduc for this amazing contribution.
ResultAsync
Overview:
This new api gives you the same Result
API, but for asynchronous results (i.e. Promise<Result<T, E>>
).
ResultAsync
is thenable
! Meaning that you can await
or .then
it just like a regular promise. But unlike regular promises, this data type also has the same API as Result
:
map
mapErr
andThen
match
Head over to the docs to learn more about this new API!
Deprecation Warning
This new ResultAsync
API will likely replace the chain
api that was introduced in version 2.2.0. If this is the decision that is taken, expect a major release. I am not yet 100% committed to this path, but I don't think it makes sense to have both a chain
and a ResultAsync
api.
✨ New Chain API 🔗
This release introduces a new set of functions for chaining async tasks.
there are 8 variants:
chain
, chain3
, chain4
, etc all the way to chain8
.
This api makes working with async Results
very very very nice!
Check out the docs for usage and examples.
Enforcing consistent `match` return type
This release introduces a breaking change with the match
method.
Previously, the 2 match arms could return different types.
V2 of neverthrow
now enforces that both arms of the match
method return the same type.
Refer to this commit for the aforementioned change: a07287e
To upgrade, simply run npm install [email protected]
in your project.