I want to do this
this.someList.forEach(item => item.someProperty = 'Some Value');
But i get these
no-return-assign Arrow function should not return assignment
no-param-reassign Assignment to property of function parameter 'item'
How do i do it diffrently?
First,
this.someList.forEach(item => { item.someProperty = 'Some Value'; });
since you're not trying to return a value from the arrow function.
As for no-param-reassign, the intent is specifically not to mutate - if item is a plain object, you could do:
const newList = this.someList.map(item => ({ ...item, someProperty: 'Some Value' }));
Yes they are plain objects so ill use map.
Didnt know about the ... syntax.
Thanks