Skip to content

Commit

Permalink
Optionalize FormikErrors (#405)
Browse files Browse the repository at this point in the history
In the examples given in JS in the docs, A function that is expected to return a `FormikErrors` object creates one with `const errors = {}`, and then conditionally adds only some members to it. This indicates that these members should be optional, which is critical for correct checking in consumer code under `strictNullChecks` mode in typescript.
  • Loading branch information
weswigham authored and jaredpalmer committed Feb 6, 2018
1 parent 7a98030 commit b6786f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/formik.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface FormikValues {
* An object containing error messages whose keys correspond to FormikValues.
* Should be always be and object of strings, but any is allowed to support i18n libraries.
*/
export type FormikErrors<Values> = { [field in keyof Values]: any };
export type FormikErrors<Values> = { [field in keyof Values]?: any };

/**
* An object containing touched state of the form whose keys correspond to FormikValues.
Expand Down

0 comments on commit b6786f4

Please sign in to comment.