with typescript I would like to manage a list of objects without using ngrx and with immutability.
as an example, I proceed as follows:
let items = <any>[];
let item1 = { n: 'toto' };
// ADD item1
items = [...items, item1];
// Find item
const item1Find = items.filter((v) => v.n == 'toto')[0];
// update item
item1Find.n = 'titi';
// update item with immuability
items = [...items, item1Find];
//
console.log('items', JSON.stringify(items)); // [{"n":"titi"},{"n":"titi"}]
but the problem is that I have 2 times the object that I modified!
I don't understand, can you help me please?