fix: fix field array type (#99)

This commit is contained in:
YuanHeDx 2025-03-28 11:41:38 +08:00 committed by GitHub
parent c75f92d379
commit ba063ae856
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ export function toFieldArray<TValue>(model: FieldArrayModel<TValue>): FieldArray
onChange: (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)),
append: (value) => toField<TValue>(model.append(value)),
/**

View File

@ -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.
* @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.
* @param value the value to append