Skip to content
Myr

Merge pull request #190 from aretecode/patch-1

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michel Weststrate · committed by GitHub · parents f0e8c47, 7bfdd78 · Browse files · 1 file+6 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • readme: consistent formatting in examples

Diff stats

1 file+6 added−6 removed

  • other:+6 added−6 removed

1 file+6 added−6 removed

modified:readme.md+6 added-6 removed
404 unmodified lines
405406The TypeScript typings automatically remove `readonly` modifiers from your draft types and return a value that matches your original type. See this practical example:407408```ts409import produce from 'immer';409import produce from 'immer'410411interface State {412 readonly x: number;412 readonly x: number413}414415// `x` cannot be modified here416const state: State = {417 x: 0;418};417 x: 0418}419420const newState = produce<State>(state, draft => {421 // `x` can be modified here422 draft.x++;423});422 draft.x++423})424425// `newState.x` cannot be modified here426```427
203 unmodified lines