Binds a validator to the given path that requires the value to be non-empty.
This function can only be called on any type of path.
In addition to binding a validator, this function adds REQUIRED property to the field.
required
voidBinds a validator to the given path that requires the value to be non-empty.
This function can only be called on any type of path.
In addition to binding a validator, this function adds REQUIRED property to the field.
@paramconfig
(BaseValidatorConfig<TValue, TPathKind> & { when?: NoInfer<LogicFn<TValue, boolean, TPathKind>> | undefined; }) | undefinedOptional, allows providing any of the following options:
message: A user-facing message for the error.error: Custom validation error(s) to be used instead of the defaultValidationError.required()or a function that receives theFieldContextand returns custom validation error(s).when: A function that receives theFieldContextand returns true if the field is required
@returns
voidJump to details