View as Markdown

API reference: @salmonui/data-grid/engine

CompiledValidatorinterface

import type { CompiledValidator } from '@salmonui/data-grid/engine';

Also exported from @salmonui/data-grid/engine/validation.

interface CompiledValidator {
    readonly required: boolean;
    validate(value: unknown, row: unknown): readonly string[];
    readonly custom: AsyncCheck | null;
}

One column's compiled rules.

CompiledValidator members (3)
NameSignatureDescription
requiredreadonly required: boolean;

True when a required rule (or an implicit primary-key requirement) applies.

validatevalidate(value: unknown, row: unknown): readonly string[];

Synchronous built-in rules: the first failing message, as a one-element array, or NO_ERRORS.

customreadonly custom: AsyncCheck | null;

Custom validators: a message, null, or a promise of either. Null when the column has no custom rule.