jaredpalmer / formik

Build forms in React, without the tears 😭
https://formik.org
Apache License 2.0
33.87k stars 2.79k forks source link

useField() FieldMetaProps error type should include arrays #3328

Open HansAarneLiblik opened 3 years ago

HansAarneLiblik commented 3 years ago

Bug report

Current Behavior

When using Formik and useField() hook with Typeahead, meta.error is typed as undefined | string, but Typeahead provides errors as string[] if there are errors with inputs

Expected behavior

meta.error should be typed as undefined | string | string[]

Note: Having a property on useField({..., array: true}) to determine if error is of type string[] wouldn't work, because the validation MAY fail with the field directly (required, ..) and not with the inputs

Your environment

Software Version(s)
Formik 2.2.9
React 17.0.2
TypeScript 4.3.5
Browser Chrome / Firefox
npm/Yarn 7
Operating System Mac OSX
HansAarneLiblik commented 1 year ago

Any progress on this ?

wtorsi commented 10 months ago

It could be an object as well