Uh oh!
There was an error while loading. Please reload this page.
fix: recursive T for WritableDraft - #1197
Conversation
Pull Request Test Coverage Report for Build 20424663455Details
💛 - Coveralls |
mweststrate
commented
Dec 29, 2025
Looks great, thanks! |
Uh oh!
There was an error while loading. Please reload this page.
🎉 This PR is included in version 11.1.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
wereHamster
commented
Jan 19, 2026
Looks like this change is causing the following code to fail: functionTest<A>(){produce((draft)=>{draft.prop=undefined;// <- type error here},{prop: undefinedasundefined|A},);}Type error on indicated line:
|
I can reproduce it. It seems like the type cannot be resolved partially like this. Is there a particular use case for this? Is there a reason to declare the type like this rather than as a whole like: functionTest<Aextends{prop: undefined}>(){produce((draft)=>{draft.prop=undefined;},{prop: undefined}asA,);} |
wereHamster
commented
Jan 19, 2026
My full code is more like this: functionMultiLineChart<AextendsTDatum<{}>>(props: Props<A>){const[state,mutate]=useImmer({hovered: undefinedasundefined|A,});constresetHover=React.useCallback(()=>{mutate((draft)=>{draft.hovered=undefined;// <- type error here});},[mutate]);}Interestingly, the following (which is quite close to your code) also errors: functionTest<A>(){typeS={prop: undefined|A}produce((draft)=>{draft.prop=undefined;// <- type error here},{prop: undefined}asS,);} |
unional
commented
Jan 19, 2026
The issue is I have a fix to defer the analysis. Let me create a PR. |
This contains a proper fix for #990
Added tests for the type check.
Included #1196 as I don't want to see the type errors in the tests.