Class ResultAsync<T, E>

Type Parameters

  • T
  • E

Implements

Constructors

Properties

_promise: any

Methods

  • Type Parameters

    • A

    Parameters

    • f: ((t) => A | Promise<A>)
        • (t): A | Promise<A>
        • Parameters

          Returns A | Promise<A>

    Returns ResultAsync<A, E>

  • Type Parameters

    • U

    Parameters

    • f: ((e) => U | Promise<U>)
        • (e): U | Promise<U>
        • Parameters

          Returns U | Promise<U>

    Returns ResultAsync<T, U>

  • Type Parameters

    • A

    Parameters

    • ok: ((t) => A)
        • (t): A
        • Parameters

          Returns A

    • _err: ((e) => A)
        • (e): A
        • Parameters

          Returns A

    Returns Promise<A>

  • Emulates Rust's ? operator in safeTry's body. See also safeTry.

    Returns AsyncGenerator<Err<never, E>, T, unknown>

  • Type Parameters

    • A
    • B

    Parameters

    • Optional successCallback: ((res) => A | PromiseLike<A>)
        • (res): A | PromiseLike<A>
        • Parameters

          Returns A | PromiseLike<A>

    • Optional failureCallback: ((reason) => B | PromiseLike<B>)
        • (reason): B | PromiseLike<B>
        • Parameters

          • reason: unknown

          Returns B | PromiseLike<B>

    Returns PromiseLike<A | B>

  • Type Parameters

    • A

    Parameters

    Returns Promise<T | A>

  • Type Parameters

    Parameters

    • asyncResultList: T

    Returns CombineResultAsyncs<T>

  • Type Parameters

    Parameters

    • asyncResultList: T

    Returns CombineResultAsyncs<T>

  • Type Parameters

    Parameters

    • asyncResultList: T

    Returns CombineResultsWithAllErrorsArrayAsync<T>

  • Type Parameters

    Parameters

    • asyncResultList: T

    Returns CombineResultsWithAllErrorsArrayAsync<T>

  • Type Parameters

    • T
    • E

    Parameters

    • promise: PromiseLike<T>
    • errorFn: ((e) => E)
        • (e): E
        • Parameters

          • e: unknown

          Returns E

    Returns ResultAsync<T, E>

  • Type Parameters

    • T
    • E = never

    Parameters

    • promise: PromiseLike<T>

    Returns ResultAsync<T, E>

  • Type Parameters

    • A extends readonly any[]
    • R
    • E

    Parameters

    • fn: ((...args) => Promise<R>)
        • (...args): Promise<R>
        • Parameters

          • Rest ...args: A

          Returns Promise<R>

    • Optional errorFn: ((err) => E)
        • (err): E
        • Parameters

          • err: unknown

          Returns E

    Returns ((...args) => ResultAsync<R, E>)