فهرست منبع

fix: fix field array type (#99)

YuanHeDx 9 ماه پیش
والد
کامیت
ba063ae856
2فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 1 1
      packages/node-engine/form/src/core/to-field-array.ts
  2. 1 1
      packages/node-engine/form/src/types/field.ts

+ 1 - 1
packages/node-engine/form/src/core/to-field-array.ts

@@ -16,7 +16,7 @@ export function toFieldArray<TValue>(model: FieldArrayModel<TValue>): FieldArray
     onChange: (value) => {
     onChange: (value) => {
       model.value = value;
       model.value = value;
     },
     },
-    map: <T = any>(cb: (f: Field, index: number) => T) =>
+    map: <T = any>(cb: (f: Field<TValue>, index: number) => T) =>
       model.map<T>((f, index) => cb(toField(f), index)),
       model.map<T>((f, index) => cb(toField(f), index)),
     append: (value) => toField<TValue>(model.append(value)),
     append: (value) => toField<TValue>(model.append(value)),
     /**
     /**

+ 1 - 1
packages/node-engine/form/src/types/field.ts

@@ -72,7 +72,7 @@ export interface FieldArray<TFieldValue extends FieldValue = FieldValue>
    * Same as native Array.map, the first param of the callback function is the child field of this FieldArray.
    * Same as native Array.map, the first param of the callback function is the child field of this FieldArray.
    * @param cb callback function
    * @param cb callback function
    */
    */
-  map: <T = any>(cb: (f: Field, index: number) => T) => T[];
+  map: <T = any>(cb: (f: Field<TFieldValue>, index: number) => T) => T[];
   /**
   /**
    * Append a value at the end of the array, it will create a new Field for this value as well.
    * Append a value at the end of the array, it will create a new Field for this value as well.
    * @param value the value to append
    * @param value the value to append