Function err

  • Create a failed result with some errors.

    Example

    import { err, isOk, isErr } from "typerun/result";

    const result = err(["error 1", "error 2"]);
    console.log(isOk(result)); // false
    console.log(isErr(result)); // true
    console.log(result.errors); // ["error 1", "error 2"]

    Type Parameters

    • E

    Parameters

    • errors: E[]

      The errors to wrap in a failed result.

    Returns Err<E>