Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types for produceWithPatches are different than for produce #850

Closed
somebody32 opened this issue Sep 2, 2021 · 1 comment
Closed

Types for produceWithPatches are different than for produce #850

somebody32 opened this issue Sep 2, 2021 · 1 comment
Labels

Comments

@somebody32
Copy link

🐛 Bug Report

produceWithPatches returns Immutable while produce is not.

That makes really hard to share the results between those two without forceful typecasting.

Link to repro

https://codesandbox.io/s/immer-immutabe-type-mismatch-wvlid

Observed behavior

newData can't be reassigned when using produceWithPatches because of the Immutability

The type 'readonly { readonly name: string; }[]' is 'readonly' and cannot be assigned to the mutable type 'DataObject[]'

Expected behavior

results from produce can be reassigned to results from produceWithPatches

Environment

  • Immer version: 9.0.6
@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 9.0.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant