Closed chpio closed 6 months ago
Hi, the passed-in draft has the type
T
(but i would expect it to beDraft<T>
), making the draft readonly if the original data type was defined as readonly.
Could you provide an example? In fact, you can use draft: Draft<typeof initState>
.
For example the same way you would in immer. By defining the fields in your state as immutable with readonly
, but get mutable fields in the produce fn: https://immerjs.github.io/immer/typescript
This works just fine with mutative#create + react#useState, just not with use-mutative#useMutative
hi @chpio , we have released version 1.0 and comprehensively fixed all known issues. Feel free to give use-mutative a try!
Hi, the passed-in draft has the type
T
(but i would expect it to beDraft<T>
), making the draft readonly if the original data type was defined as readonly.