Skip to content

Commit

Permalink
fix(core): allow adding array of refs to collection (#3859)
Browse files Browse the repository at this point in the history
just small fix for type

Co-authored-by: Boris Damiryan <b.damiryan@cyrm.ru>
  • Loading branch information
hehmonke and Boris Damiryan committed Dec 20, 2022
1 parent 98316d1 commit 0ce85e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/entity/Collection.ts
Expand Up @@ -118,7 +118,7 @@ export class Collection<T extends object, O extends object = object> extends Arr
return super.toJSON();
}

add(entity: T | Reference<T> | T[], ...entities: (T | Reference<T>)[]): void {
add(entity: T | Reference<T> | (T | Reference<T>)[], ...entities: (T | Reference<T>)[]): void {
entities = Utils.asArray(entity).concat(entities);
const unwrapped = entities.map(i => Reference.unwrapReference(i)) as T[];
unwrapped.forEach(entity => this.validateItemType(entity));
Expand Down

0 comments on commit 0ce85e9

Please sign in to comment.