Evercatch - v0.12.0
    Preparing search index...

    Type Alias InferErr<R>

    InferErr: ErrOf<ResultOf<R>>

    Infers the error type of a result.

    Works on a Result, a ResultAsync, and on functions returning either, such as a ResultFn or a ResultAsyncFn. A result that can never fail, such as a ResultOk, has the error type never.

    Type Parameters

    • R extends Inferable

      The result, async result or result-returning function.

    async function fetchUser(id: string): ResultAsync<User, "NOT_FOUND" | "NETWORK"> {
    // ...
    }

    type FetchUserError = InferErr<typeof fetchUser>; // "NOT_FOUND" | "NETWORK"