@@ -29,7 +29,7 @@ export function createSortedStateAdapter<T>(
2929 }
3030
3131 function addManyMutably (
32- newEntities : T [ ] | Record < EntityId , T > ,
32+ newEntities : readonly T [ ] | Record < EntityId , T > ,
3333 state : R
3434 ) : void {
3535 newEntities = ensureEntitiesArray ( newEntities )
@@ -48,7 +48,7 @@ export function createSortedStateAdapter<T>(
4848 }
4949
5050 function setManyMutably (
51- newEntities : T [ ] | Record < EntityId , T > ,
51+ newEntities : readonly T [ ] | Record < EntityId , T > ,
5252 state : R
5353 ) : void {
5454 newEntities = ensureEntitiesArray ( newEntities )
@@ -58,7 +58,7 @@ export function createSortedStateAdapter<T>(
5858 }
5959
6060 function setAllMutably (
61- newEntities : T [ ] | Record < EntityId , T > ,
61+ newEntities : readonly T [ ] | Record < EntityId , T > ,
6262 state : R
6363 ) : void {
6464 newEntities = ensureEntitiesArray ( newEntities )
@@ -72,6 +72,7 @@ export function createSortedStateAdapter<T>(
7272 return updateManyMutably ( [ update ] , state )
7373 }
7474
75+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
7576 function takeUpdatedModel ( models : T [ ] , update : Update < T > , state : R ) : boolean {
7677 if ( ! ( update . id in state . entities ) ) {
7778 return false
@@ -88,7 +89,10 @@ export function createSortedStateAdapter<T>(
8889 return newKey !== update . id
8990 }
9091
91- function updateManyMutably ( updates : Update < T > [ ] , state : R ) : void {
92+ function updateManyMutably (
93+ updates : ReadonlyArray < Update < T > > ,
94+ state : R
95+ ) : void {
9296 const models : T [ ] = [ ]
9397
9498 updates . forEach ( ( update ) => takeUpdatedModel ( models , update , state ) )
@@ -103,7 +107,7 @@ export function createSortedStateAdapter<T>(
103107 }
104108
105109 function upsertManyMutably (
106- newEntities : T [ ] | Record < EntityId , T > ,
110+ newEntities : readonly T [ ] | Record < EntityId , T > ,
107111 state : R
108112 ) : void {
109113 const [ added , updated ] = splitAddedUpdatedEntities < T > (
@@ -116,7 +120,7 @@ export function createSortedStateAdapter<T>(
116120 addManyMutably ( added , state )
117121 }
118122
119- function areArraysEqual ( a : unknown [ ] , b : unknown [ ] ) {
123+ function areArraysEqual ( a : readonly unknown [ ] , b : readonly unknown [ ] ) {
120124 if ( a . length !== b . length ) {
121125 return false
122126 }
@@ -130,7 +134,7 @@ export function createSortedStateAdapter<T>(
130134 return true
131135 }
132136
133- function merge ( models : T [ ] , state : R ) : void {
137+ function merge ( models : readonly T [ ] , state : R ) : void {
134138 // Insert/overwrite all new/updated
135139 models . forEach ( ( model ) => {
136140 state . entities [ selectId ( model ) ] = model
0 commit comments