Skip to content

Loosen ExtractKeysOfValueType type check on Formik fields #421

@fantkolja

Description

@fantkolja

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions