jannikbuschke / formik-antd

Simple declarative bindings for Ant Design and Formik.
https://codesandbox.io/s/github/jannikbuschke/formik-antd-example
MIT License
589 stars 81 forks source link

TypeError: children does not exist on type FormikFieldProps #222

Open martynaskup opened 1 week ago

martynaskup commented 1 week ago

I get the following errors upon upgrading React from to v18. It related only to the FormikFieldProps defined (in formik-antd) in FieldProps.tsx

src/field/index.tsx (in props)

TS2339: Property children does not exist on type FormikFieldProps

checkbox/index.tsx (in both Checkbox and Checkbox.Group components - Type error for the Field component

TS2322: Type { children: ({field: {value}, form: {setFieldValue, setFieldTouched},}: FieldProps<any, any>) => Element;
name: string; validate: ((value: any) => string | Promise | undefined) | undefined; } is not assignable to type IntrinsicAttributes & FormikFieldProps Property children does not exist on type IntrinsicAttributes & FormikFieldProps

@jannikbuschke Could you please check this and fix it? It looks like FormikFieldProps should contain either children?: React.ReactNode prop, just when I add it manually (only to see if this would work), I get a different TypeError in Checkbox and Checkbox.Group:

TS2322: Type ({field: {value}, form: {setFieldValue, setFieldTouched},}: FieldProps) => JSX. Element is not assignable to type ReactNode

jannikbuschke commented 1 week ago

I am quite busy with other stuff, but if you open a PR I could test/review and publish a new version

martynaskup commented 1 week ago

@jannikbuschke Thank you for your fast reply. I created a PR #223 . Once you've tested/reviewed it and all is fine, please merge it to the version 2 and 3.