API
function applyWhenValue<TValue, TNarrowed extends TValue>(
path: FieldPath<TValue>,
predicate: (value: TValue) => value is TNarrowed,
schema: SchemaOrSchemaFn<TNarrowed>,
): void;
function applyWhenValue<TValue>(
path: FieldPath<TValue>,
predicate: (value: TValue) => boolean,
schema: NoInfer<SchemaOrSchemaFn<TValue>>,
): void;function applyWhenValue<TValue, TNarrowed>(path: FieldPath<TValue>, predicate: (value: TValue) => value is TNarrowed, schema: SchemaOrSchemaFn<TNarrowed>): void;Conditionally applies a predefined schema to a given FieldPath.
@parampredicate
(value: TValue) => value is TNarrowedA type guard that accepts a value T and returns true if T is of type
TNarrowed.
@paramschema
SchemaOrSchemaFn<TNarrowed>The schema to apply to the field when predicate returns true.
@returns
voidfunction applyWhenValue<TValue>(path: FieldPath<TValue>, predicate: (value: TValue) => boolean, schema: NoInfer<SchemaOrSchemaFn<TValue>>): void;Conditionally applies a predefined schema to a given FieldPath.
@parampredicate
(value: TValue) => booleanA function that accepts a value T and returns true when the schema
should be applied.
@paramschema
NoInfer<SchemaOrSchemaFn<TValue>>The schema to apply to the field when predicate returns true.
@returns
voidJump to details