You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type '{ initialValues: { foo: string; bar: string; }; initialErrors: FormikErrors<unknown>; initialTouched: FormikTouched<unknown>; initialStatus: any; handleBlur: (eventOrString: any) => void | ((e: any) => void); ... 32 more ...; submitCount: number; }' is not assignable to type 'FormikProps<FormikValues>'.
Type '{ initialValues: { foo: string; bar: string; }; initialErrors: FormikErrors<unknown>; initialTouched: FormikTouched<unknown>; initialStatus: any; handleBlur: (eventOrString: any) => void | ((e: any) => void); ... 32 more ...; submitCount: number; }' is not assignable to type 'FormikHelpers<FormikValues>'.
Types of property 'setFormikState' are incompatible.
Type '(stateOrCb: FormikState<{ foo: string; bar: string; }> | ((state: FormikState<{ foo: string; bar: string; }>) => FormikState<{ foo: string; bar: string; }>)) => void' is not assignable to type '(f: FormikState<FormikValues> | ((prevState: FormikState<FormikValues>) => FormikState<FormikValues>), cb?: (() => void) | undefined) => void'.
Types of parameters 'stateOrCb' and 'f' are incompatible.
Type 'FormikState<FormikValues> | ((prevState: FormikState<FormikValues>) => FormikState<FormikValues>)' is not assignable to type 'FormikState<{ foo: string; bar: string; }> | ((state: FormikState<{ foo: string; bar: string; }>) => FormikState<{ foo: string; bar: string; }>)'.
Type 'FormikState<FormikValues>' is not assignable to type 'FormikState<{ foo: string; bar: string; }> | ((state: FormikState<{ foo: string; bar: string; }>) => FormikState<{ foo: string; bar: string; }>)'.
Type 'FormikState<FormikValues>' is not assignable to type 'FormikState<{ foo: string; bar: string; }>'.
Types of property 'values' are incompatible.
Type 'FormikValues' is not assignable to type '{ foo: string; bar: string; }'
Expected behavior
I expected the type definition to allow the same assignments it did before Formik 2.
Reproducible example
Here's a somewhat realistic example of the kind of component that this change has broken:
馃悰 Bug report
Current Behavior
After upgrading from Formik 1 -> Formik 2, FormikProps has become too strict and can no longer be used in generic components. For example:
results in:
Expected behavior
I expected the type definition to allow the same assignments it did before Formik 2.
Reproducible example
Here's a somewhat realistic example of the kind of component that this change has broken:
https://codesandbox.io/s/react-typescript-4sc41
Suggested solution(s)
Is this intentional or is it a bug? If it's not a bug, please document the intended migration path for components that use generic
FormikProps
.Additional context
Your environment
The text was updated successfully, but these errors were encountered: