Skip to main content

ContextualAsyncValidatorFn()

type ContextualAsyncValidatorFn<TForm, TField> = (value, ctx) => Promise<ValidationError | null>;

Defined in: core/types/validation-schema.ts:51

Асинхронная функция валидации поля с контекстом

Type Parameters

TForm

TForm

TField

TField

Parameters

value

TField

ctx

FormContext<TForm>

Returns

Promise<ValidationError | null>

Example

validateAsync(path.email, async (value, ctx) => {
const exists = await checkEmailExists(value);
if (exists) return { code: 'exists', message: 'Email already taken' };
return null;
});