Skip to content

FormRuleDef ​

A form rule, as defineFormRule takes it.

Generics ​

Definition ​

  • FormRuleDef
    • params TParams: optional, its params, next to rule, field and message
    • reads (params) => readonly string[]: the paths it reads besides field
    • kinds readonly ValueKind[]: optional, the kinds the fields may have. Any without it
    • sameKind boolean: optional, true when every field must have the same kind
    • check (values: readonly unknown[], params) => boolean: true when the values pass: field's first, then those of reads
    • meta RuleMeta: optional

Explanation ​

check runs only when none of the fields has an issue of its own or is empty. The issues of other form rules don't count, so their order never changes what a rule reports. See custom rules.

Functions ​