Evercatch - v0.10.0
    Preparing search index...

    Variable unwrapOrThrowReadonly

    unwrapOrThrow: <T, E extends unknown = Error>(result: Result<T, E>) => T

    Type declaration

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

        Type Parameters

        • T

          The type of the value.

        • E extends unknown = Error

          The type of the error.

        Parameters

        • result: Result<T, E>

          The Result to unwrap.

        Returns T

        The unwrapped value.

        The error if the result contains an error.

        const result = someFunctionThatReturnsResult();
        const value = unwrapOrThrow(result);
        console.log(value);