Skip to content

Commit

Permalink
docs: added TypeScript readonly types note
Browse files Browse the repository at this point in the history
  • Loading branch information
mweststrate committed Dec 4, 2019
1 parent e504e0b commit d3be40e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ const newState = increment(state, 2)
// `newState.x` cannot be modified here
```

_Note: Since TypeScript support for recursive types is limited, and there is no co- contravariance, it might the easiest to not type your state as `readonly` (Immer will still protect against accidental mutations)_

**Note:** Immer v1.9+ supports TypeScript v3.1+ only.

**Note:** Immer v3.0+ supports TypeScript v3.4+ only.
Expand Down

0 comments on commit d3be40e

Please sign in to comment.