point.halo 10 месяцев назад
Родитель
Сommit
a168b16d39

+ 1 - 1
packages/semi-foundation/utils/object.ts

@@ -14,7 +14,7 @@ type Many<T> = T | ReadonlyArray<T>;
 type PropertyName = string | number | symbol;
 type PropertyPath = Many<PropertyName>;
 
-type ObjectType = Record<string, any>;
+export type ObjectType = Record<string, any>;
 
 const pathToArrayElem = (path: any) => {
     const pathArray = lodashToPath(path);

+ 2 - 2
packages/semi-ui/form/hooks/useFieldState.tsx

@@ -5,8 +5,8 @@ import { FormState } from '../interface';
 
 const buildFieldState = (formState: FormState, field: string) => ({
     value: ObjectUtil.get(formState.values, field),
-    error: ObjectUtil.get(formState.errors, field),
-    touched: ObjectUtil.get(formState.touched, field),
+    error: ObjectUtil.get(formState.errors as ObjectUtil.ObjectType, field),
+    touched: ObjectUtil.get(formState.touched as ObjectUtil.ObjectType, field),
 });
 
 function useFieldState(field: string) {