In my Angular 10 project with Typescript 3.9, I have the following class definition:
export class Document {
constructor(
public id: number,
...
public tags: Tag[]
) {
this.id = id;
...
this.tags = tags;
}
}
Whenever I attempt to modify the "tags" property in an existing object by reassigning or pushing new values like so:
document.tags = ...
I encounter the following error:
ERROR TypeError: "tags" is read-only
This behavior surprises me as I do not recall setting the property as
read-only
Has anyone experienced such an issue before? Could you shed some light on where this error might originate from?
I recently updated from Angular 7 to 10 and am puzzled by this new behavior, especially since the upgrade guide did not mention anything about it.
Even though it goes against best practices, I tried deactivating strict mode to see if that would fix the problem, but unfortunately, it did not work either.
Any insights or ideas on how to resolve this issue would be greatly appreciated.