Function when

  • Call a callback when validation succeeds

    Type Parameters

    • T

      The validated type

    Parameters

    • validator: Validator<T>

      The validator to use

    • callback: ((t) => void)

      The callback to call

        • (t): void
        • Parameters

          Returns void

    Returns ((input) => void)

      • (input): void
      • Parameters

        • input: unknown

        Returns void

    Example

    when(isNumber, () => {...})