After updating my project from Typescript 3.5 to 3.8, everything was running smoothly except for some operations on arrays.
const usedROI = this.rois.find((roi) => roi.id === roiId);
usedROI.position.height = position.height;
ERROR TypeError: Cannot assign to read only property 'height' of object '[object Object]'
let rerouteWaypoint = route.waypoints.filter((wp) => wp.type === IWaypointType.REROUTE_POINT);
rerouteWaypoint.forEach((wp) => (wp.type = IWaypointType.USER_POINT));
ERROR TypeError: Cannot assign to read only property 'type' of object '[object Array]'
const wps = state.entities[action.payload.routeId].waypoints;
const wp = {
...wps[index],
...action.payload.changes,
};
wps[index] = { ...wp }; <= this line breaks
core.js:4117 ERROR TypeError: Cannot assign to read only property '0' of object '[object Array]'
Despite not using readonly anywhere in my app, all my arrays seem to be frozen and uneditable.
Why is this happening? I didn't see it mentioned in the breaking changes. Is there a way to identify all the occurrences of this issue in Visual Studio Code? Right now, errors only appear at runtime, making it unsafe to deploy this version.
EDIT: I found a similar problem discussed here, but I'm puzzled as to why simple arrays are also encountering this issue without being stored in Redux.