diff --git a/modules/entity/spec/sorted_state_adapter.spec.ts b/modules/entity/spec/sorted_state_adapter.spec.ts index cc9116b6b0..ce142c9a1b 100644 --- a/modules/entity/spec/sorted_state_adapter.spec.ts +++ b/modules/entity/spec/sorted_state_adapter.spec.ts @@ -11,6 +11,20 @@ describe('Sorted State Adapter', () => { let adapter: EntityStateAdapter; let state: EntityState; + beforeAll(() => { + Object.defineProperty(Array.prototype, 'unwantedField', { + enumerable: true, + configurable: true, + value: 'This should not appear anywhere', + }); + }); + + afterAll(() => { + Object.defineProperty(Array.prototype, 'unwantedField', { + value: undefined, + }); + }); + beforeEach(() => { adapter = createEntityAdapter({ selectId: (book: BookModel) => book.id, diff --git a/modules/entity/src/sorted_state_adapter.ts b/modules/entity/src/sorted_state_adapter.ts index 15aaecbad0..ed2b297da6 100644 --- a/modules/entity/src/sorted_state_adapter.ts +++ b/modules/entity/src/sorted_state_adapter.ts @@ -116,8 +116,7 @@ export function createSortedStateAdapter(selectId: any, sort: any): any { const added: T[] = []; const updated: Update[] = []; - for (let index in updates) { - const update = updates[index]; + for (const update of updates) { if (update.id in state.entities) { updated.push(update); } else {