@@ -70,26 +70,26 @@ export interface FormProps<FormValues = AnyObject>
7070 initialValuesEqual ?: ( a ?: AnyObject , b ?: AnyObject ) => boolean ;
7171}
7272
73- export interface UseFieldConfig {
73+ export interface UseFieldConfig < FieldValue > {
7474 afterSubmit ?: ( ) => void ;
7575 allowNull ?: boolean ;
7676 beforeSubmit ?: ( ) => void | boolean ;
77- defaultValue ?: any ;
78- format ?: ( value : any , name : string ) => any ;
77+ defaultValue ?: FieldValue ;
78+ format ?: ( value : FieldValue , name : string ) => any ;
7979 formatOnBlur ?: boolean ;
80- initialValue ?: any ;
80+ initialValue ?: FieldValue ;
8181 isEqual ?: ( a : any , b : any ) => boolean ;
8282 multiple ?: boolean ;
83- parse ?: ( value : any , name : string ) => any ;
83+ parse ?: ( value : any , name : string ) => FieldValue ;
8484 subscription ?: FieldSubscription ;
8585 type ?: string ;
8686 validate ?: FieldValidator ;
8787 validateFields ?: string [ ] ;
88- value ?: any ;
88+ value ?: FieldValue ;
8989}
9090
91- export interface FieldProps < T extends HTMLElement >
92- extends UseFieldConfig ,
91+ export interface FieldProps < FieldValue , T extends HTMLElement >
92+ extends UseFieldConfig < FieldValue > ,
9393 RenderableProps < FieldRenderProps < T > > {
9494 name : string ;
9595 [ otherProp : string ] : any ;
@@ -104,12 +104,18 @@ export interface FormSpyProps<FormValues = AnyObject>
104104 extends UseFormStateParams < FormValues > ,
105105 RenderableProps < FormSpyRenderProps < FormValues > > { }
106106
107- export const Field : React . FC < FieldProps < any > > ;
108- export const Form : React . FC < FormProps < AnyObject > > ;
109- export const FormSpy : React . FC < FormSpyProps < AnyObject > > ;
110- export function useField < T extends HTMLElement > (
107+ export const Field : < FieldValue = any , T extends HTMLElement = HTMLElement > (
108+ props : FieldProps < FieldValue , T >
109+ ) => React . ReactElement ;
110+ export const Form : < FormValues = AnyObject > (
111+ props : FormProps < FormValues >
112+ ) => React . ReactElement ;
113+ export const FormSpy : < FormValues = AnyObject > (
114+ props : FormSpyProps < FormValues >
115+ ) => React . ReactElement ;
116+ export function useField < FieldValue = any , T extends HTMLElement = HTMLElement > (
111117 name : string ,
112- config ?: UseFieldConfig
118+ config ?: UseFieldConfig < FieldValue >
113119) : FieldRenderProps < T > ;
114120export function useForm < FormValues = AnyObject > (
115121 componentName ?: string
0 commit comments