Function invalidateWith

  • Invalidate an input and serialize it with a failure message

    Type Parameters

    • T

      The validated type

    Parameters

    • reason: string

      The failure message

    Returns Validator<T>

    Example

    invalidateWith("Not a number")("1") >>
    {
    valid: false,
    input: "",
    parsed: null,
    error: 'Not a number: "1"',
    };