Avoid Object Reference Mutation Medium

Modifying objects through direct references without proper copying can cause unexpected side effects where changes to a copied object accidentally modify the original data. This is particularly problematic in larger applications where object references are shared across different components. Always create proper copies of objects before modification using appropriate methods like spread operator, structuredClone(), or JSON.parse(JSON.stringify()).

Detector ID
typescript/avoid-object-reference-mutation@v1.0
Category
Common Weakness Enumeration (CWE) external icon