Evercatch - v0.10.0
    Preparing search index...

    Variable unwrapOrThrowReadonly

    unwrapOrThrow: <T, E extends unknown = Error>(
        resultAsync: ResultAsync<T, E>,
    ) => Promise<T> = unwrapAsyncOrThrow

    Type declaration

      • <T, E extends unknown = Error>(resultAsync: ResultAsync<T, E>): Promise<T>
      • Unwraps a ResultAsync, throwing the error if it exists.

        Type Parameters

        • T

          The type of the value.

        • E extends unknown = Error

          The type of the error.

        Parameters

        Returns Promise<T>

        A promise that resolves to the unwrapped value.

        The error if the result contains an error.

        const result = someAsyncFunctionThatReturnsResult();
        const value = await unwrapAsyncOrThrow(result);
        console.log(value);