Skip to content

produceWithPatches wrong return type聽#1045

Closed
zextras/carbonio-ws-collaboration-ui
#806

Description

@omnitout

馃悰 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)

Activity

  1. added a commit that references this issue on Jul 16, 2026
    a3be9df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions