Skip to content

Commit

Permalink
fix(forms): improve field error method type defs
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
vicrep committed May 10, 2019
1 parent 6eacfd7 commit 6119095
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ export type WrappedFormUtils<V = any> = {
validateFieldsAndScroll(options: ValidateFieldsOptions): void;
validateFieldsAndScroll(): void;
/** 获取某个输入控件的 Error */
getFieldError(name: string): Object[];
getFieldsError(names?: Array<string>): Object;
getFieldError(name: string): string[] | undefined;
getFieldsError(names?: Array<string>): Record<string, string[] | undefined>;
/** 判断一个输入控件是否在校验状态 */
isFieldValidating(name: string): boolean;
isFieldTouched(name: string): boolean;
Expand Down

0 comments on commit 6119095

Please sign in to comment.