import { INPUT_VALIDATION_RULES } from '../constants'; import { Message } from './errors'; import { FieldValues } from './fields'; import { FieldPath, FieldPathValue } from './path'; export type ValidationValue = boolean | number | string | RegExp; export type ValidationRule = TValidationValue | ValidationValueMessage; export type ValidationValueMessage = { value: TValidationValue; message: Message; }; export type ValidateResult = Message | Message[] | boolean | undefined; export type Validate = (value: TFieldValue, formValues: TFormValues) => ValidateResult | Promise; export type RegisterOptions = FieldPath> = Partial<{ required: Message | ValidationRule; min: ValidationRule; max: ValidationRule; maxLength: ValidationRule; minLength: ValidationRule; validate: Validate, TFieldValues> | Record, TFieldValues>>; value: FieldPathValue; setValueAs: (value: any) => any; shouldUnregister?: boolean; onChange?: (event: any) => void; onBlur?: (event: any) => void; disabled: boolean; deps: FieldPath | FieldPath[]; }> & ({ pattern?: ValidationRule; valueAsNumber?: false; valueAsDate?: false; } | { pattern?: undefined; valueAsNumber?: false; valueAsDate?: true; } | { pattern?: undefined; valueAsNumber?: true; valueAsDate?: false; }); export type InputValidationRules = typeof INPUT_VALIDATION_RULES; export type MaxType = InputValidationRules['max'] | InputValidationRules['maxLength']; export type MinType = InputValidationRules['min'] | InputValidationRules['minLength']; //# sourceMappingURL=validator.d.ts.map