TS2540
Cannot assign to 'name' because it is a read-only property.
Broken Code ❌
const user = { name: 'Benny' } as const;
user.name = 'Sofia';Fixed Code ✔️
The user object has been initialized with a const assertion, indicating to the compiler that the object is immutable. If you wish to reintroduce mutability, you have to remove the const assertion:
const user = { name: 'Benny' };
user.name = 'Sofia';