TS2540
error TS2540: Cannot assign to ‘
name
‘ because it is a read-only property.
Broken Code ❌
1 |
|
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:
1 |
|