Skip to content

Commit 388ed15

Browse files
authored
Update ValidationRule message type (#3163)
1 parent d552a41 commit 388ed15

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

components/form-model/Form.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const FormProps = {
2323

2424
export const ValidationRule = {
2525
/** validation error message */
26-
message: PropTypes.string,
26+
message: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
2727
/** built-in validation type, available options: https://github.com/yiminghe/async-validator#type */
2828
type: PropTypes.string,
2929
/** indicates whether field is required */

components/form/Form.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const FormProps = {
7575

7676
export const ValidationRule = {
7777
/** validation error message */
78-
message: PropTypes.string,
78+
message: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
7979
/** built-in validation type, available options: https://github.com/yiminghe/async-validator#type */
8080
type: PropTypes.string,
8181
/** indicates whether field is required */

types/form-model/form.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ declare interface ValidationRule {
1111
trigger?: string;
1212
/**
1313
* validation error message
14-
* @type string
14+
* @type string | Function
1515
*/
16-
message?: string;
16+
message?: string | (() => string)
1717

1818
/**
1919
* built-in validation type, available options: https://github.com/yiminghe/async-validator#type

types/form/form.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ export type ValidateFieldsOptions = {
5151
declare interface ValidationRule {
5252
/**
5353
* validation error message
54-
* @type string
54+
* @type string | Function
5555
*/
56-
message?: string;
56+
message?: string | (() => string)
5757

5858
/**
5959
* built-in validation type, available options: https://github.com/yiminghe/async-validator#type

0 commit comments

Comments
 (0)