Skip to main content

Validator

Synchronous validator receiving the current value as a reactive signal.

Import​

import type { Validator } from '@ngblocks/form-nodes';

When to use it​

Use to type a reusable synchronous rule. Author it through validator() when you want contextual value and owner inference from the consuming declaration.

Declaration​

type Validator<TValue> = (context: FieldContext<TValue>) => ValidationResult;

Type parameters​

ParameterConstraintDefault
TValueUnconstrainedRequired