Type Alias RefinePredicate<Value, RefinedValue, Param>

RefinePredicate<Value, RefinedValue, Param>: ((value: Value, param: Param, options: ParseOptions) => value is RefinedValue)

A narrowing predicate that refines the value type.

If a ValidationError is thrown, its issues are captured and incorporated into a parsing result. Throw if refinement cannot be performed, and you want to abort the operation.

Type Parameters

  • Value = any

    The value to refine.

  • RefinedValue extends Value = Value

    The refined value.

  • Param = any

    The additional param that was associated with the operation.

Type declaration

    • (value, param, options): value is RefinedValue
    • Parameters

      • value: Value

        The value to refine.

      • param: Param

        The additional param that was associated with the operation.

      • options: ParseOptions

        Parsing options.

      Returns value is RefinedValue

      true if value matches the predicate, or false otherwise.