Open munizart opened 3 years ago
Update: I've created this draft PR (#3177) so the proposed solution can be tested more easily.
The NoInfer type was sourced from here and has some known issues. I think we might want to wait for an official recommended NoInfer type.
I personally never use the ExtraProps here, so I may underestimate how large of a problem this is. If it's not a major problem and can be worked around by triple checking for typos, we should probably wait for an official solution.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days
Bug report
Current Behavior
<Formik />
accepts any prop, this make it impossible for TS compiler to find typos on props name.Expected behavior
IMHO, unexpected props should not be acceptable by default, but rather require explicit type
Reproducible example
Suggested solution(s)
Currently, passing
Formik
explicit type parameters works around this behavior.This works because it bypass type inference for type parameters and the compiler was inferring the
ExtraProps
withvalidationScheme
on it. To solve this it's needed to somehow disable inference forExtraProps
. The way i find to work is to change:to
Additional context
Affects only typescript users
Your environment