8
8
FieldValidator
9
9
} from 'final-form'
10
10
11
- export interface FormRenderProps extends FormState {
12
- form : FormApi
11
+ export interface FormRenderProps < S > extends FormState < S > {
12
+ form : FormApi < S >
13
13
handleSubmit : (
14
14
event ?: React . SyntheticEvent < HTMLFormElement >
15
15
) => Promise < object | undefined > | undefined
@@ -25,7 +25,7 @@ type NonFunctionPropertyNames<T> = {
25
25
} [ keyof T ]
26
26
type NonFunctionProperties < T > = Pick < T , NonFunctionPropertyNames < T > >
27
27
28
- export interface FieldRenderProps < V = any > {
28
+ export interface FieldRenderProps < V = any , T = string > {
29
29
input : {
30
30
name : string
31
31
onBlur : < T > ( event ?: React . FocusEvent < T > ) => void
@@ -34,20 +34,20 @@ export interface FieldRenderProps<V = any> {
34
34
value : V
35
35
checked ?: boolean
36
36
}
37
- meta : NonFunctionProperties < FieldState >
37
+ meta : NonFunctionProperties < FieldState < T > >
38
38
}
39
39
40
40
declare module 'react-final-form-hooks' {
41
- export function useForm < C = FormConfig > ( config : C ) : FormRenderProps
42
- export function useFormState (
43
- form : FormApi ,
41
+ export function useForm < C = FormConfig , S = object > ( config : C ) : FormRenderProps < S >
42
+ export function useFormState < S = object > (
43
+ form : FormApi < S > ,
44
44
subscription ?: FormSubscription
45
- ) : FormRenderProps
45
+ ) : FormRenderProps < S >
46
46
47
- export function useField < V = any > (
47
+ export function useField < V = any , S = object > (
48
48
name : string ,
49
- form : FormApi ,
50
- validate ?: FieldValidator ,
49
+ form : FormApi < S > ,
50
+ validate ?: FieldValidator < V > ,
51
51
subscription ?: FieldSubscription
52
52
) : FieldRenderProps < V >
53
53
}
0 commit comments