Skip to content

Variable.fromPromise

GitHub Actions edited this page May 22, 2025 · 1 revision

resultar / fromPromise

Variable: fromPromise()

const fromPromise: <T, E>(promise, errorFn) => ResultAsync<T, E> = ResultAsync.fromPromise

Defined in: result-async.ts:474

Returns a ResultAsync instance that is resolved with a Result.ok(value) or Result.err(error) based on the provided promise.

Type Parameters

T

T

E

E

Parameters

promise

PromiseLike<T>

The promise to be wrapped in a ResultAsync.

errorFn

(e) => E

A function that transforms the error from the promise into the error type E.

Returns

ResultAsync<T, E>

A ResultAsync instance with the given promise and error type E.

Clone this wiki locally