formik: Switching to v2.0.1 gives TypeScript error
🐛 Bug report
Current Behavior
The following code worked perfectly fine in 2.0.1-rc.12
return (
<Formik<FormEntity>
...
render={({ resetForm }) => (
<Form className={classes.form}>
<TextField
name="name"
type="text"
label="Name"
margin="normal"
fullWidth
/>
...
</Form>
)}
/>
);
However, switching to version 2.0.1 gives the following TypeScript error:
Type '{ children: Element[]; className: string; }' is not assignable to type 'IntrinsicAttributes & RefAttributes<HTMLFormElement>'.
Property 'children' does not exist on type 'IntrinsicAttributes & RefAttributes<HTMLFormElement>'. TS2322
119 | }}
120 | render={({ resetForm }) => (
> 121 | <Form className={classes.form}>
| ^
122 | <TextField
123 | name="name"
124 | type="text"
Expected behavior
No TypeScript error when moving to v2.0.1. I can’t find this as being a breaking change in the release notes.
Your environment
| Software | Version(s) |
|---|---|
| Formik | 2.0.1 |
| React | 16.11.0 |
| TypeScript | 3.6.4 |
| Browser | |
| npm/Yarn | |
| Operating System |
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 8
- Comments: 16 (4 by maintainers)
I am also seeing the same original issue on
<Form>:@jaredpalmer using 2.1.1 results in the typescript error. I checked typescript example from docs:
formik 2.1.1 typescript 3.5.3
I’m also still getting this error using 2.0.2
@jaredpalmer I’m still seeing this issue in 2.0.2…
Type ‘{ children: Element[]; }’ has no properties in common with type ‘IntrinsicAttributes & RefAttributes<HTMLFormElement>’.
Yeah, just tested it locally, it is solved in 2.0.3, thanks!
Should be fixed in 2.0.2
@jaredpalmer, looks like you have published 2.0.3 to address this issue. Will try ii as soon as I get a chance. FYI, if anyone else wants to give it a try.