Skip to content

New `ResultAsync` API

Compare
Choose a tag to compare
@supermacro supermacro released this 20 May 16:38
· 721 commits to master since this release

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.