immer
immer copied to clipboard
Expose a `Producer<T>` generic type
🚀 Feature Proposal
Right now it's really hard to figure out how to properly type a producer function. It would be really nice if there was an easy Producer<T>
to refer to a the producer function for a Draft<T>
.
For example to pass a producer function around in React's context.
Example
let ProducerContext = createContext<Producer<MyState> | null>(null)
Makes sense! PR welcome
Good idea! PR welcome :)
On Tue, Jun 28, 2022 at 7:33 PM Ian Storm Taylor @.***> wrote:
🚀 Feature Proposal
Right now it's really hard to figure out how to properly type a producer function. It would be really nice if there was an easy Producer<T> to refer to a the producer function for a Draft<T>.
For example to pass a producer function around in React's context. Example
let ProducerContext = createContext<Produce<MyState> | null>(null)
— Reply to this email directly, view it on GitHub https://github.com/immerjs/immer/issues/955, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN4NBDPQF2R6OBN43NJNKTVRNAPXANCNFSM52DD3CBA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@mweststrate I think there is a PR, although not sure the naming is quite right.
I saw there was an open PR for this but had a comment on it for rename and has since not been addressed can I just update that? what are the rules for this?
I've created one on draft at the moment https://github.com/immerjs/immer/pull/1004
This issue can probably be closed given that PR #968 has been merged