fix: add warning when validating form for non-string type (#3128)
Co-authored-by: 成仕伟 <chengsw@heywhale.com>pull/3131/head^2^2
parent
a3d48834f1
commit
343e3aa2e4
|
@ -75,6 +75,12 @@ async function validateRule(
|
||||||
subRuleField = cloneRule.defaultField;
|
subRuleField = cloneRule.defaultField;
|
||||||
delete cloneRule.defaultField;
|
delete cloneRule.defaultField;
|
||||||
}
|
}
|
||||||
|
if (!rule.type && typeof rule.validator !== 'function' && typeof value !== 'string') {
|
||||||
|
warning(
|
||||||
|
false,
|
||||||
|
`Form rules must provide type property when validating a value which is not string type`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const validator = new AsyncValidator({
|
const validator = new AsyncValidator({
|
||||||
[name]: [cloneRule],
|
[name]: [cloneRule],
|
||||||
|
|
Loading…
Reference in New Issue