From b6786f42aa12158252cbfbfd1cd8ae63ac46355d Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 6 Feb 2018 07:19:16 -0800 Subject: [PATCH] Optionalize `FormikErrors` (#405) 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. --- src/formik.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/formik.tsx b/src/formik.tsx index af26bedb8..6bf0f2e2c 100644 --- a/src/formik.tsx +++ b/src/formik.tsx @@ -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 = { [field in keyof Values]: any }; +export type FormikErrors = { [field in keyof Values]?: any }; /** * An object containing touched state of the form whose keys correspond to FormikValues.