@@ -64,26 +64,26 @@ export interface FormProps<FormValues = object>
6464 initialValuesEqual ?: ( a ?: object , b ?: object ) => boolean ;
6565}
6666
67- export interface UseFieldConfig {
67+ export interface UseFieldConfig < FieldValue > {
6868 afterSubmit ?: ( ) => void ;
6969 allowNull ?: boolean ;
7070 beforeSubmit ?: ( ) => void | boolean ;
71- defaultValue ?: any ;
72- format ?: ( value : any , name : string ) => any ;
71+ defaultValue ?: FieldValue ;
72+ format ?: ( value : FieldValue , name : string ) => any ;
7373 formatOnBlur ?: boolean ;
74- initialValue ?: any ;
74+ initialValue ?: FieldValue ;
7575 isEqual ?: ( a : any , b : any ) => boolean ;
7676 multiple ?: boolean ;
77- parse ?: ( value : any , name : string ) => any ;
77+ parse ?: ( value : FieldValue , name : string ) => FieldValue ;
7878 subscription ?: FieldSubscription ;
7979 type ?: string ;
8080 validate ?: FieldValidator ;
8181 validateFields ?: string [ ] ;
82- value ?: any ;
82+ value ?: FieldValue ;
8383}
8484
85- export interface FieldProps < T extends HTMLElement >
86- extends UseFieldConfig ,
85+ export interface FieldProps < FieldValue , T extends HTMLElement >
86+ extends UseFieldConfig < FieldValue > ,
8787 RenderableProps < FieldRenderProps < T > > {
8888 name : string ;
8989 [ otherProp : string ] : any ;
@@ -98,12 +98,18 @@ export interface FormSpyProps<FormValues>
9898 extends UseFormStateParams < FormValues > ,
9999 RenderableProps < FormSpyRenderProps < FormValues > > { }
100100
101- export const Field : React . FC < FieldProps < any > > ;
102- export const Form : React . FC < FormProps < object > > ;
103- export const FormSpy : React . FC < FormSpyProps < object > > ;
104- export function useField < T extends HTMLElement > (
101+ export const Field : < FieldValue = any , T extends HTMLElement = HTMLElement > (
102+ props : FieldProps < FieldValue , T >
103+ ) => React . ReactElement ;
104+ export const Form : < FormValues = object > (
105+ props : FormProps < FormValues >
106+ ) => React . ReactElement ;
107+ export const FormSpy : < FormValues = object > (
108+ props : FormSpyProps < FormValues >
109+ ) => React . ReactElement ;
110+ export function useField < FieldValue = any , T extends HTMLElement = HTMLElement > (
105111 name : string ,
106- config ?: UseFieldConfig
112+ config ?: UseFieldConfig < FieldValue >
107113) : FieldRenderProps < T > ;
108114export function useForm < FormValues = object > (
109115 componentName ?: string
0 commit comments