-
-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
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
Upgraded to 1.7.2, typescript typedefs changes failing build #205
Comments
As an update to this, the old style type defs work better for my codebase:
The code doesn't really need to use the Draft state, so it's easier just to leave it like this. Not sure if you still consider these "valid" or not, but they still look ok to me. |
@scriby can you demonstrate this in a sandbox, because if I read your example correctly, your recipe returns |
@scriby What version of TypeScript are you using? Repro: https://codesandbox.io/s/x7y885rlww (I don't know which TS version is in CodeSandbox) My fix passes in TypeScript playground, but I don't know which TS version is used there. It also passes locally using Strangely, the repro code also passes in TypeScript playground. |
The problem was that the generic |
Fixes #205 I don't think this works under TypeScript 3.0 (or even 3.1)
Since filing this issue I've noticed the TS version at work doesn't (or doesn't always?) treat void and undefined as the same type. We're on a little older version, so that might be the cause. I'll go ahead and close for now until we get on a more recent version. |
🎉 This issue has been resolved in version 1.9.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Attempting to build Typescript code that looks like this doesn't work anymore:
This code built previously under 1.2.1, but does not build under 1.7.2 (only change is I changed
State
toDraft<State>
). Typescript is complaining that "void" is not assignable to type DraftObject.I think it's supposed to be matching this type def:
I think the issue is that the typedef declares that the recipe function will return an "S", but that's going to be difficult because it receives a
Draft<S>
. Tweaking the type def locally and having recipe returnvoid|Draft<S>
fixes the issue for me.setUseProxies(true)
)setUseProxies(false)
)The text was updated successfully, but these errors were encountered: