0

I just upgraded Angular from 6 to 11 and also typescript to 4.1.5. I have problems with changing properties of any object from an array. It results with an error

core.js:6150 ERROR TypeError: Cannot assign to read only property 'active' of object '[object Object]'

The object I'm trying to change is:

  export interface Agreement {
    active: boolean;
    ...
}

Also when I try to add something to any list, I get this error:

ERROR TypeError: Cannot add property 4, object is not extensible
at Array.push (<anonymous>)

Am I missing any global config property?

1 Answer 1

0

I simply created a copy of given field like this:

field = JSON.parse(JSON.stringify(field))

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.