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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

produceWithPatches wrong return type #1045

Open
3 tasks done
omnitout opened this issue Apr 30, 2023 · 0 comments
Open
3 tasks done

produceWithPatches wrong return type #1045

omnitout opened this issue Apr 30, 2023 · 0 comments

Comments

@omnitout
Copy link

馃悰 Bug Report

The curried form of produceWithPatches returns the wrong type, while produce does.

Link to repro

https://codesandbox.io/s/producewithpatches-wrong-return-type-mr5hdp?file=/src/index.ts

Observed behavior

The state returned by produceWithPatches((draft: Draft<N>, m: number) => { ... }) is of type WritableDraft<N> but should be of type N.

The type of produceWithPatches<N, [number]>((draft, m) => { ... }) is never while the type of produce<N, [number]>((draft, m) => { ... }) is as expected.

Expected behavior

The types of the values returned by produceWithPatches should be the same as produce.

Environment

  • Immer version: 10.0.1
  • I filed this report against the latest version of Immer
  • Occurs with setUseProxies(true)
  • Occurs with setUseProxies(false) (ES5 only)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant