/// import { RuleItem, ValidateError } from 'async-validator'; export type CustomRuleFunc = ({ getFieldValue }: { getFieldValue: any; }) => RuleItem; export type CustomRule = RuleItem | CustomRuleFunc; export interface FieldDetail { name: string; value: string; rules: CustomRule[]; isValid: boolean; errors: ValidateError[]; } export interface FieldsState { [key: string]: FieldDetail; } export interface ValidateErrorType extends Error { errors: ValidateError[]; fields: Record; } export interface FormState { isValid: boolean; isSubmitting: boolean; errors: Record; } export interface FieldsAction { type: 'addField' | 'updateValue' | 'updateValidateResult'; name: string; value: any; } declare function useStore(initialValues?: Record): { fields: FieldsState; dispatch: import("react").Dispatch; form: FormState; validateField: (name: string) => Promise; getFieldValue: (key: string) => string; validateAllFields: () => Promise<{ isValid: boolean; errors: Record; values: { [x: string]: string; }; }>; getFieldsValue: () => { [x: string]: string; }; setFieldValue: (name: string, value: any) => void; resetFields: () => void; }; export default useStore;