You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we are validating a value being a list (ie. supported by FieldArray) then some errors on the list might be null (ie. [null, "error"]), but current typescript definitions don't allow for that.
Expected behavior
Following code (along sandbox don't produce typescript compiler errors):
? Values[K][number]extendsobject// [number] is the special sauce to get the type of array's element. More here https://github.com/Microsoft/TypeScript/pull/21316
exporttypeFormikErrors<Values>={[KinkeyofValues]?: Values[K]extendsany[]
? Values[K][number]extendsobject// [number] is the special sauce to get the type of array's element. More here https://github.com/Microsoft/TypeScript/pull/21316
? (FormikErrors<Values[K][number]>|null)[]|string|(string|null)[]
: string|(string|null)[]
: Values[K]extendsobject
? FormikErrors<Values[K]>
: string;};
Your environment
Software
Version(s)
Formik
2.0.6
The text was updated successfully, but these errors were encountered:
馃悰 Bug report
Current Behavior
If we are validating a value being a list (ie. supported by FieldArray) then some errors on the list might be null (ie.
[null, "error"]
), but current typescript definitions don't allow for that.Expected behavior
Following code (along sandbox don't produce typescript compiler errors):
Reproducible example
https://codesandbox.io/s/formik-fieldarray-sb4ql
Suggested solution(s)
formik/src/types.tsx
Lines 13 to 21 in 5c59dbe
should allow nulls in array of errors:
Your environment
The text was updated successfully, but these errors were encountered: