Function Err

Returns a new Err result type with the provided error

  • Type Parameters

    • E

    Parameters

    • err: E

      Error of the result

    Returns Result<never, E>

    Err("I failed!");
    
    const functionThatCanFail = (condition) => {
    if (condition) {
    Ok("Success")
    }

    return Err("Failure");
    }