formik icon indicating copy to clipboard operation
formik copied to clipboard

FormikTouched is typed incorrectly for primitive array values

Open kmurgic opened this issue 3 years ago • 2 comments

Bug report

Current Behavior

For values { x: string [] }, touched is being typed as { x?: boolean }

Expected behavior

For values { x: string [] }, touched should be typed as { x?: boolean[] }

Reproducible example

https://codesandbox.io/s/infallible-shape-nhd9i?file=/index.tsx:537-685 Edit the names of one of the friends. Note that in the console touched.friends is an array of booleans.

Suggested solution(s)

Replace boolean with boolean[] here I ~plan on making~ opened up a one line PR.

kmurgic avatar Jan 11 '22 17:01 kmurgic

Opened a PR

kmurgic avatar Jan 11 '22 17:01 kmurgic

I think this is intended behavior, touched is describing the field not the contents of the field.

quantizor avatar Oct 09 '24 07:10 quantizor