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
{{ message }}
Repository navigation
[TypeScript] Produced draft is read-only if original state is read-only #97
The draft returned by the produce function's callback should make a mutable clone from the original state. Currently immutability is retained:
interfaceIState{readonlyfoo: boolean;}conststate: IState={foo: false};produce(state,draft=>{draft.foo=true;// Error: Cannot assign to 'foo' because it is a constant or a read-only property.});
changed the title [-][TypeScript] Produced draft is not mutable if original state is readonly[/-][+][TypeScript] Produced draft is read-only if original state is read-only[/+]on Feb 15, 2018
Activity
olavim commentedon Feb 15, 2018
I submitted a PR to fix this.
As a quick solution until this is fixed in a release:
[-][TypeScript] Produced draft is not mutable if original state is readonly[/-][+][TypeScript] Produced draft is read-only if original state is read-only[/+]mweststrate commentedon Jul 25, 2018
Released as 1.4.0. Have fun!