Make formik helpers types stricter#3362
Make formik helpers types stricter#3362khevamann wants to merge 2 commits intojaredpalmer:masterfrom khevamann:patch-1
Conversation
|
|
@khevamann is attempting to deploy a commit to the Formium Team on Vercel. A member of the Team first needs to authorize it. |
|
This doesn't work for nested fields, you can see WIP #3152 for an example of how TypeScript would need to be used to support nested fields. |
|
@johnrom Ok so should I just close this in favor of that PR or make a change to support the nested fields? |
|
I would probably recommend checking out that PR as it has tons and tons of type fixes. You can branch from there and continue trying to get the TS even tighter (I haven't kept up with some of the more recent releases which could have even more powerful methods of typing), or you can test it in development by using this fork While developing Formik on that branch, the types are a little bit too complex, even though they work pretty well, which results in a bit of development lag. I haven't felt it when actually using the fork in a real project, though. |
|
@johnrom I forgot to reply, I looked at the PR you mentioned and it looks like it already handles this typing, so I will close this in favor of that. I may create a few PRs branching from that to try and help with typing |
This PR updates the types of the helpers such as
setFieldValuesto make sure that only field names that exist in the FormValues type are allowed. Provides better completion as well as error detection.