You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### Caveat: Readonly does not provide recursive immutability on objects
725
-
> This means that readonly modifier will not be propagated on nested properties of objects or arrays of objects.
725
+
> This means that readonly modifier does not propagate immutability on nested properties of objects or arrays of objects. You'll need to set it explicitly on each nested property.
state.counterContainer= { mutableCounter: 1 }; // Error, cannot be mutated
736
+
state.counterContainer.readonlyCounter=1; // Error, cannot be mutated
735
737
736
738
state.counterContainer.mutableCounter=1; // No error, can be mutated
737
739
```
738
740
739
-
> You can still achieve nested immutability but you'll need to explicitly mark every nested property as readonly. You can do this quite easily by using convenient `Readonly` or `ReadonlyArray` mapped types.
741
+
> There are few utilities to help you achieve nested immutability. e.g. you can do it quite easily by using convenient `Readonly` or `ReadonlyArray` mapped types.
#### Caveat: Readonly does not provide recursive immutability on objects
68
-
> This means that readonly modifier will not be propagated on nested properties of objects or arrays of objects.
68
+
> This means that readonly modifier does not propagate immutability on nested properties of objects or arrays of objects. You'll need to set it explicitly on each nested property.
state.counterContainer= { mutableCounter: 1 }; // Error, cannot be mutated
79
+
state.counterContainer.readonlyCounter=1; // Error, cannot be mutated
78
80
79
81
state.counterContainer.mutableCounter=1; // No error, can be mutated
80
82
```
81
83
82
-
> You can still achieve nested immutability but you'll need to explicitly mark every nested property as readonly. You can do this quite easily by using convenient `Readonly` or `ReadonlyArray` mapped types.
84
+
> There are few utilities to help you achieve nested immutability. e.g. you can do it quite easily by using convenient `Readonly` or `ReadonlyArray` mapped types.
0 commit comments