fix: add warning when validating form for non-string type (#3128)

Co-authored-by: 成仕伟 <chengsw@heywhale.com>
pull/3131/head^2^2
就是喜欢陈粒 2020-11-07 22:54:01 +08:00 committed by GitHub
parent a3d48834f1
commit 343e3aa2e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -75,6 +75,12 @@ async function validateRule(
subRuleField = 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({
[name]: [cloneRule],