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

Loosen ExtractKeysOfValueType type check on Formik fields #421

Open
fantkolja opened this issue Dec 16, 2021 · 0 comments
Open

Loosen ExtractKeysOfValueType type check on Formik fields #421

fantkolja opened this issue Dec 16, 2021 · 0 comments

Comments

@fantkolja
Copy link
Collaborator

fantkolja commented Dec 16, 2021

There are issues with field "name" type, I mean the type calculated with the ExtractKeysOfValueType utility.
Especially with a nested object form value type, so if the name is like mapStore.className the utility can't determine the type falling back to never...
I see two options:

  • Formik is using a simple string type for all names, we could do the same. But it would be a degradation, since ExtractKeysOfValueType works nice in 90% of cases.
  • Add a possibility to turn strict type of bypassing a ready type value, e.g. in the exanple if passing the second generic argument (string) it won't check with ExtractKeysOfValueType
<SelectFieldFormik<MapConfigurationFormValues, string>
   options={customClassesOptions}
   label="Class Name"
   name="mapStore.className"
   disabled={Boolean(errorMessage)}
/>

Comment from @allfayn
We can take one of these strategies:

  • try use default string type as a prop, then not have FormValues
  • use the second parameter as above
  • use recursive type for this complex form values
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

1 participant