Skip to content

Commit a61e3fc

Browse files
tobilenerikras
authored andcommitted
Update typescript definition file (#50)
* Update typescript definition file This incorporates the changes introduced in final-form with [this commit](final-form/final-form@59bcfb2), version 4.15.0 ( https://github.com/final-form/final-form/releases/tag/v4.15.0 ) * Require final-form version with the type changes * Pass through type params to final-form * Update lockfile
1 parent 80ebe2b commit a61e3fc

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"eslint-plugin-react": "^7.11.1",
5858
"eslint-plugin-react-hooks": "^1.6.0",
5959
"fast-deep-equal": "^2.0.1",
60-
"final-form": "^4.11.1",
60+
"final-form": "^4.15.0",
6161
"hoek": ">=4.2.1",
6262
"husky": "^1.1.1",
6363
"jest": "^24.5.0",

src/index.d.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import {
88
FieldValidator
99
} from 'final-form'
1010

11-
export interface FormRenderProps extends FormState {
12-
form: FormApi
11+
export interface FormRenderProps<S> extends FormState<S> {
12+
form: FormApi<S>
1313
handleSubmit: (
1414
event?: React.SyntheticEvent<HTMLFormElement>
1515
) => Promise<object | undefined> | undefined
@@ -25,7 +25,7 @@ type NonFunctionPropertyNames<T> = {
2525
}[keyof T]
2626
type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>
2727

28-
export interface FieldRenderProps<V = any> {
28+
export interface FieldRenderProps<V = any, T = string> {
2929
input: {
3030
name: string
3131
onBlur: <T>(event?: React.FocusEvent<T>) => void
@@ -34,20 +34,20 @@ export interface FieldRenderProps<V = any> {
3434
value: V
3535
checked?: boolean
3636
}
37-
meta: NonFunctionProperties<FieldState>
37+
meta: NonFunctionProperties<FieldState<T>>
3838
}
3939

4040
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>,
4444
subscription?: FormSubscription
45-
): FormRenderProps
45+
): FormRenderProps<S>
4646

47-
export function useField<V = any>(
47+
export function useField<V = any, S = object>(
4848
name: string,
49-
form: FormApi,
50-
validate?: FieldValidator,
49+
form: FormApi<S>,
50+
validate?: FieldValidator<V>,
5151
subscription?: FieldSubscription
5252
): FieldRenderProps<V>
5353
}

0 commit comments

Comments
 (0)