Validator functions
Validator functions can either by synchronous or asynchronous.
These functions must resolve with native Error instance if the validation should fail, or with undefined
if the validation should pass.
type ValidationResult = Error | undefinedSynchronous
type Validator<
  TForm,
  TMeta extends Record<string, unknown> = Record<string, unknown>
> = (form: TForm, meta: TMeta) => ValidationResultSuitable for quick client side validations like empty fields, or regex statements.
Asynchronous
type AsyncValidator<
  TForm,
  TMeta extends Record<string, unknown> = Record<string, unknown>
> = (form: TForm, signal: AbortSignal, meta: TMeta) => Promise<ValidationResult>Suitable for any kind of validation that must be resolved with a Promise.
Function is called with the latest form values and the fresh instance of AbortSignal that can be used to cancel in flight requests.