You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using it with a readonly source array will make TypeScript complain with TS2345:
constsource: readonlynumber[]=[1,2,3];constsource$=of(source).pipe(mapArray((item)=>item*2)// ^ The type 'readonly number[]' is 'readonly' and cannot be assigned to the mutable type 'number[]'.ts(2345));
I would argue that any function consuming an array should most likely type the argument as readonly so both mutable and readonly arrays are accepted. Except, of course, if said function is supposed to actually modify the consumed array.
The text was updated successfully, but these errors were encountered:
Because
mapArray
's implementation expects a mutable array typeusing it with a readonly source array will make TypeScript complain with TS2345:
I would argue that any function consuming an array should most likely type the argument as readonly so both mutable and readonly arrays are accepted. Except, of course, if said function is supposed to actually modify the consumed array.
The text was updated successfully, but these errors were encountered: