From ba063ae8564fea815220be733bd794627b4ffed2 Mon Sep 17 00:00:00 2001 From: YuanHeDx <96035115+YuanHeDx@users.noreply.github.com> Date: Fri, 28 Mar 2025 11:41:38 +0800 Subject: [PATCH] fix: fix field array type (#99) --- packages/node-engine/form/src/core/to-field-array.ts | 2 +- packages/node-engine/form/src/types/field.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/node-engine/form/src/core/to-field-array.ts b/packages/node-engine/form/src/core/to-field-array.ts index e3700ab2..38877cec 100644 --- a/packages/node-engine/form/src/core/to-field-array.ts +++ b/packages/node-engine/form/src/core/to-field-array.ts @@ -16,7 +16,7 @@ export function toFieldArray(model: FieldArrayModel): FieldArray onChange: (value) => { model.value = value; }, - map: (cb: (f: Field, index: number) => T) => + map: (cb: (f: Field, index: number) => T) => model.map((f, index) => cb(toField(f), index)), append: (value) => toField(model.append(value)), /** diff --git a/packages/node-engine/form/src/types/field.ts b/packages/node-engine/form/src/types/field.ts index 461d423a..6f2bb317 100644 --- a/packages/node-engine/form/src/types/field.ts +++ b/packages/node-engine/form/src/types/field.ts @@ -72,7 +72,7 @@ export interface FieldArray * Same as native Array.map, the first param of the callback function is the child field of this FieldArray. * @param cb callback function */ - map: (cb: (f: Field, index: number) => T) => T[]; + map: (cb: (f: Field, 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