We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import { produce, Draft } from 'immer'; const x = { a: 1 }; function wrapper<T>(s: T, fn: (d: Draft<T>) => void) { const result = produce(s, (y) => { return fn(y); }); return result; } function wrapper2<T>(s: T, fn: (d: Draft<T>) => any) { const result = produce(s, (y) => { return fn(y); }); return result; } const res = wrapper(x, (y) => { y.a = 1; }); // {a:number} const res2 = wrapper2(x, (y) => { y.a = 2; }); // Promise<{a:number}> res2.then(x => { console.log('x:',x) // crash }) console.log(x, res, res2);
https://www.typescriptlang.org/play?#code/PTAEAEBcGcFoGMAWBTeBrAUASwLYAcB7AJ0lAG9Q8iCATAV3mQBpQARIgQwDNSBfULtRygA5LhzIiIgNwZ4BAHbRSAD1ABecqA4AuUAEZQvWfKWkAnhsrV6jABQqWdmgEoNAPnIZQoGgDoOKwAmWV4XWS46BXhILEVQAHdOPDxJAB4AFXc7aD0Mli4FPWc9dm5ITPc3dU8ANwIsVy8fU2VQImRoOgAbUk0qWgZkHKdzas8ybx925Eg6IgUBBTsx2R8wtZm5hZmu3tCMDEjo2PikjhTJIMqcvIKi0BK2Th5K8e0FMebQVtIOvb61kG9mgo3ek2mW3mi0KK3CUw2Uw620W-x6kAOv12VnOlyIDjBHm+5gCVn0oXCoBA5F0CjoOAARpJeHJFG1-kEcclUkQggTHl8asTSZoQhgNlSwAAFIRYaDINJkWn0plEXjuVlKAjdZB+boEADm-PMLH+ps6QXhQA
The text was updated successfully, but these errors were encountered:
fix: immerjs#785 fix type inference for produce
9c0419c
2ee9859
6555173
🎉 This issue has been resolved in version 9.0.2 🎉
The release is available on:
Your semantic-release bot 📦🚀
Sorry, something went wrong.
No branches or pull requests
🐛 Bug Report
Link to repro
https://www.typescriptlang.org/play?#code/PTAEAEBcGcFoGMAWBTeBrAUASwLYAcB7AJ0lAG9Q8iCATAV3mQBpQARIgQwDNSBfULtRygA5LhzIiIgNwZ4BAHbRSAD1ABecqA4AuUAEZQvWfKWkAnhsrV6jABQqWdmgEoNAPnIZQoGgDoOKwAmWV4XWS46BXhILEVQAHdOPDxJAB4AFXc7aD0Mli4FPWc9dm5ITPc3dU8ANwIsVy8fU2VQImRoOgAbUk0qWgZkHKdzas8ybx925Eg6IgUBBTsx2R8wtZm5hZmu3tCMDEjo2PikjhTJIMqcvIKi0BK2Th5K8e0FMebQVtIOvb61kG9mgo3ek2mW3mi0KK3CUw2Uw620W-x6kAOv12VnOlyIDjBHm+5gCVn0oXCoBA5F0CjoOAARpJeHJFG1-kEcclUkQggTHl8asTSZoQhgNlSwAAFIRYaDINJkWn0plEXjuVlKAjdZB+boEADm-PMLH+ps6QXhQA
The text was updated successfully, but these errors were encountered: