API ReferenceValidationFunction
defineValidationRule()
function defineValidationRule<P>(): <DependsOn, RevalidateOn>(definition) => ValidationRule<P>;Creates a validation rule whose callback can read only fields declared by dependsOn or
revalidateOn.
The returned value is the existing structural ValidationRule; this helper strengthens authoring without changing the runner contract or invalidating third-party rule objects. An undeclared runtime read indicates a rule-topology defect and throws with the missing field name.
Callbacks must read declared fields individually. Key enumeration, including Object.keys,
Reflect.ownKeys, and object spread, always throws because it could otherwise observe absent
undeclared fields without registering them as incremental-validation watches.
Type Parameters
| Type Parameter |
|---|
P |
Returns
<DependsOn, RevalidateOn>(definition) =>
ValidationRule<P>