-
Notifications
You must be signed in to change notification settings - Fork 12
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
Typing of get() does not include computed state #15
Comments
The code works as expected; property |
The best way would be to make the root type FullState = State & ReturnType<typeof computeState> |
With Closest workaround I could find was: type FullState = State & Partial<ReturnType<typeof computeState>> Downside of this is that all computed values will be potentially |
Hey, @geirsagberg, sorry to take so long to get back to you. Unfortunately, with Immer, Immer derives the type for it's |
One other suggestion, you could try swapping Immer & computed. Otherwise, closing this issue. |
Hey, figured out the issue. Middleware types were not cascading down appropriately. I would suggest trying out version 2.0 and see if the new pattern brings the types through appropriately. I also opened (#2696)[https://github.com/pmndrs/zustand/pull/2696] to address the aforementioned issue with Immer deriving the |
Given the following code:
Is there a way to make
get()
automatically include the computed properties?The text was updated successfully, but these errors were encountered: