Const
Wraps a PromiseLike<T> into a ResultAsync. Reject reasons go through onReject to become typed Errs; success becomes Ok<T>.
PromiseLike<T>
onReject
Err
Ok<T>
const body = fromPromise( fetch(url).then((r) => r.text()), (e): NetworkError => ({ kind: "network", cause: String(e) }),); Copy
const body = fromPromise( fetch(url).then((r) => r.text()), (e): NetworkError => ({ kind: "network", cause: String(e) }),);
Wraps a
PromiseLike<T>into a ResultAsync. Reject reasons go throughonRejectto become typedErrs; success becomesOk<T>.