RuleDef
A rule, as defineRule takes it.
Generics
TParamsextends AnyObjectSchema
Definition
RuleDefkindsreadonly ValueKind[]: the kinds of field it fitsstageRuleStage: optional,'normalize'or'validate', the defaultparamsTParams | ((kind: ValueKind) => TParams): optional, the params it takesmetaRuleMeta: optionalcreate(params, message?: string) => AnyAction: the Valibot action for its params and message
Explanation
See custom rules.
RuleMeta
RuleMetalabelstringdescriptionstring: optionalcategoryRuleCategory
RuleCategory
ts
type RuleCategory =
| 'length'
| 'text'
| 'content'
| 'format'
| 'date'
| 'comparison'
| 'number'
| 'file'
| 'normalize'
| (string & {})RuleStage
ts
type RuleStage = 'normalize' | 'validate'normalize rules run before the required check, so ' ' with trim counts as empty. validate rules run after it.