Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: children does not exist on type FormikFieldProps #222

Open
martynaskup opened this issue Oct 30, 2024 · 9 comments
Open

TypeError: children does not exist on type FormikFieldProps #222

martynaskup opened this issue Oct 30, 2024 · 9 comments

Comments

@martynaskup
Copy link
Contributor

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
Copy link
Owner

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

@martynaskup
Copy link
Contributor Author

@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
Copy link
Contributor Author

@jannikbuschke Hi, any updates on this, please?

@jannikbuschke
Copy link
Owner

will check this evening, sorry for the delay

@martynaskup
Copy link
Contributor Author

Thank you!

jannikbuschke added a commit that referenced this issue Nov 11, 2024
Add children props to Field component - Issue #222
@jannikbuschke
Copy link
Owner

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

@jannikbuschke
Copy link
Owner

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

@martynaskup
Copy link
Contributor Author

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
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants