UNPKG

formik-fields

Version:

An extension to the great formik-library

14 lines (13 loc) 1.26 kB
import { FormikFieldsConfig, FormikFieldState } from './types'; export declare type FieldValidator<Values> = (value: Values[keyof Values]) => any; export declare type ValidatorMap<Values> = { [K in keyof Values & string]?: (val: Values[K]) => any; }; export declare type FormikBagToFormikFieldState<Values> = (value: Values[keyof Values & string], error: any, isTouched: boolean, setFieldValue: (field: keyof Values & string, value: any, shouldValidate?: boolean) => void, setFieldTouched: (field: keyof Values & string, isTouched?: boolean, shouldValidate?: boolean) => void) => FormikFieldState<Values[keyof Values & string]>; export declare type FormikBagToFormikFieldStateMap<Values> = { [K in keyof Values & string]: FormikBagToFormikFieldState<Values>; }; export declare function getFieldKeys<Values>(props: FormikFieldsConfig<Values>): (keyof Values & string)[]; export declare function calcInitialValues<Values>(props: FormikFieldsConfig<Values>): Values; export declare function calcMemoizedValidatorsFromProps<Values>(props: FormikFieldsConfig<Values>): ValidatorMap<Values>; export declare function calcMemoizedFormikBagToFormikFieldStateMap<Values>(props: FormikFieldsConfig<Values>): FormikBagToFormikFieldStateMap<Values>;