From 611909514c9e9fa2c49cb710b61958519d372ed1 Mon Sep 17 00:00:00 2001 From: Victor Repkow Date: Fri, 10 May 2019 15:22:55 -0400 Subject: [PATCH] fix(forms): improve field error method type defs Change `getFieldError` and `getFieldsError` to return actual types, instead of very restrictive `Object` type (which should be avoided in general, in favour of `unknown`, `object`, or `Record` depending on actual use). --- components/form/Form.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/form/Form.tsx b/components/form/Form.tsx index dcc45e112e..1175bba25a 100755 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -171,8 +171,8 @@ export type WrappedFormUtils = { validateFieldsAndScroll(options: ValidateFieldsOptions): void; validateFieldsAndScroll(): void; /** 获取某个输入控件的 Error */ - getFieldError(name: string): Object[]; - getFieldsError(names?: Array): Object; + getFieldError(name: string): string[] | undefined; + getFieldsError(names?: Array): Record; /** 判断一个输入控件是否在校验状态 */ isFieldValidating(name: string): boolean; isFieldTouched(name: string): boolean;