UNPKG

569 BTypeScriptView Raw
1export interface FormFieldValidator {
2 name: string;
3 [key: string]: any;
4}
5export interface FormState {
6 valid: boolean;
7 invalid: boolean;
8 untouched: boolean;
9 touched: boolean;
10 pristine: boolean;
11 dirty: boolean;
12}
13export interface FormField extends FormState {
14 value: any;
15 errors: any;
16 validators: Array<string | FormFieldValidator>;
17}
18export interface FormGroup extends FormState {
19 [key: string]: FormField | FormField[] | FormGroup | boolean;
20}
21export declare function useForm<T>(rawSchema: T): {
22 form: FormGroup;
23};