From d8328ba0d0bd32a3c810dcabf3a7d2739238cfea Mon Sep 17 00:00:00 2001 From: Sean Wisely Date: Fri, 9 Dec 2016 15:26:15 +1100 Subject: [PATCH] Typescript ControlProps UpdateOn/ValidateOn Fixes UpdateOn and ValidateOn also allow an array of change, blur and/or focus. --- react-redux-form.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/react-redux-form.d.ts b/react-redux-form.d.ts index be1301f11..9af09f3fd 100644 --- a/react-redux-form.d.ts +++ b/react-redux-form.d.ts @@ -101,6 +101,9 @@ type MapPropsObject = { [key: string]: (props: MapPropsProps) => any }; type MapProps = MapPropsFunc | MapPropsObject; +type UpdateOn = 'change' | 'blur' | 'focus'; +type ValidateOn = 'change' | 'blur' | 'focus'; + export interface ControlProps extends React.HTMLProps { /** * Wrap field into custom component @@ -127,7 +130,7 @@ export interface ControlProps extends React.HTMLProps { * * */ - updateOn?: 'change' | 'blur' | 'focus'; + updateOn?: UpdateOn | UpdateOn[]; /** * A map where the keys are validation keys, and the values are the corresponding functions that determine the validity of each key, given the model's value. * Validator functions accept the value and return true if the field is valid. @@ -142,7 +145,7 @@ export interface ControlProps extends React.HTMLProps { * * @default change */ - validateOn?: 'change' | 'blur' | 'focus'; + validateOn?: ValidateOn | ValidateOn[]; asyncValidators?: AsyncValidators; /** * Indicates when to validate the field asynchronously