import { ReactNode } from 'react'; import { AnySchema as YupSchema, ValidationError as YupValidationError } from 'yup'; export declare type Translator = (errorObj: YupValidationError) => string | ReactNode; export interface ValidationError { [key: string]: ValidationError | string; } /** * Wraps the execution of a Yup schema to return an Promise * where the key is the form field and the value is the error string. */ export declare function makeValidate(validator: YupSchema, translator?: Translator): (values: T) => Promise; /** * Wraps the sync execution of a Yup schema to return an ValidationError * where the key is the form field and the value is the error string. */ export declare function makeValidateSync(validator: YupSchema, translator?: Translator): (values: T) => ValidationError; /** * Uses the private _exclusive field in the schema to get whether or not * the field is marked as required or not. */ export declare function makeRequired(schema: YupSchema): any;