jannikbuschke / formik-antd

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

TypeError: children does not exist on type FormikFieldProps #222

Open martynaskup opened 3 weeks ago

martynaskup commented 3 weeks 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 3 weeks 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 3 weeks 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.

martynaskup commented 1 week ago

@jannikbuschke Hi, any updates on this, please?

jannikbuschke commented 1 week ago

will check this evening, sorry for the delay

martynaskup commented 1 week ago

Thank you!

jannikbuschke commented 1 week ago

@martynaskup are you on antd 4 or 5? cause I have problems building the formikt-antd v2 (targeting antd4)

jannikbuschke commented 1 week ago

I now published 2.0.5, can you check if it works?

martynaskup commented 1 week ago

I am on antd 4 at the moment. I hope to upgrade to antd 5 soon hence I would appreciate to have this solution also for the antd 5. Thank you! I'll check on this tomorrow and let you know.

martynaskup commented 1 week ago

I checked 2.0.5. and it works now. Thank you!