We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 88406c8 + 98f7005 commit a00ebefCopy full SHA for a00ebef
src/array.ts
@@ -82,9 +82,7 @@ export class ArrayType<T extends IAnyType> extends BaseType<Array<T["InputType"]
82
instantiate(snapshot: this["InputType"] | undefined, context: TreeContext, parent: IStateTreeNode | null): this["InstanceType"] {
83
const array = new QuickArray<T>(this, parent, context);
84
if (snapshot) {
85
- for (let index = 0; index < snapshot?.length; ++index) {
86
- array.push(this.childrenType.instantiate(snapshot[index], context, array));
87
- }
+ array.push(...snapshot.map((element) => this.childrenType.instantiate(element, context, array)));
88
}
89
return array as this["InstanceType"];
90
0 commit comments