Skip to content

Commit 343e3aa

Browse files
Lucian-4a25成仕伟
and
成仕伟
authored
fix: add warning when validating form for non-string type (#3128)
Co-authored-by: 成仕伟 <[email protected]>
1 parent a3d4883 commit 343e3aa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

components/form/utils/validateUtil.ts

+6
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ async function validateRule(
7575
subRuleField = cloneRule.defaultField;
7676
delete cloneRule.defaultField;
7777
}
78+
if (!rule.type && typeof rule.validator !== 'function' && typeof value !== 'string') {
79+
warning(
80+
false,
81+
`Form rules must provide type property when validating a value which is not string type`,
82+
);
83+
}
7884

7985
const validator = new AsyncValidator({
8086
[name]: [cloneRule],

0 commit comments

Comments
 (0)