From 388ed15e82fac2e4d3729270b5138e81e6273e26 Mon Sep 17 00:00:00 2001 From: Emmanuel Pastor Date: Fri, 13 Nov 2020 04:08:27 +0100 Subject: [PATCH] Update ValidationRule message type (#3163) --- components/form-model/Form.jsx | 2 +- components/form/Form.jsx | 2 +- types/form-model/form.d.ts | 4 ++-- types/form/form.d.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/form-model/Form.jsx b/components/form-model/Form.jsx index de6fcdcdd..d480516c3 100755 --- a/components/form-model/Form.jsx +++ b/components/form-model/Form.jsx @@ -23,7 +23,7 @@ export const FormProps = { export const ValidationRule = { /** validation error message */ - message: PropTypes.string, + message: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), /** built-in validation type, available options: https://github.com/yiminghe/async-validator#type */ type: PropTypes.string, /** indicates whether field is required */ diff --git a/components/form/Form.jsx b/components/form/Form.jsx index 17b03a7d3..f3750ce58 100755 --- a/components/form/Form.jsx +++ b/components/form/Form.jsx @@ -75,7 +75,7 @@ export const FormProps = { export const ValidationRule = { /** validation error message */ - message: PropTypes.string, + message: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), /** built-in validation type, available options: https://github.com/yiminghe/async-validator#type */ type: PropTypes.string, /** indicates whether field is required */ diff --git a/types/form-model/form.d.ts b/types/form-model/form.d.ts index 5c1baf922..ef498cc58 100644 --- a/types/form-model/form.d.ts +++ b/types/form-model/form.d.ts @@ -11,9 +11,9 @@ declare interface ValidationRule { trigger?: string; /** * validation error message - * @type string + * @type string | Function */ - message?: string; + message?: string | (() => string) /** * built-in validation type, available options: https://github.com/yiminghe/async-validator#type diff --git a/types/form/form.d.ts b/types/form/form.d.ts index 8967cde48..cc5fb73c2 100644 --- a/types/form/form.d.ts +++ b/types/form/form.d.ts @@ -51,9 +51,9 @@ export type ValidateFieldsOptions = { declare interface ValidationRule { /** * validation error message - * @type string + * @type string | Function */ - message?: string; + message?: string | (() => string) /** * built-in validation type, available options: https://github.com/yiminghe/async-validator#type