Typescript issue with 5.0.2 #2926
Replies: 3 comments 5 replies
-
@AndyRightNow Can you help this? |
Beta Was this translation helpful? Give feedback.
-
I just created a minimal reproduction here https://stackblitz.com/edit/vitejs-vite-b4fksmbb?file=src%2Fstore.ts However it's weird that I can't seem to be able to reproduce it locally in unit tests. I will look into it and find a fix when I can. |
Beta Was this translation helpful? Give feedback.
-
Could you upgrade to export const createStore = <TStore extends Record<string, unknown>>(
- getStore: (set: NamedSet<TStore>) => TStore,
+ getStore: StateCreator<TStore>,
) => create<TStore>()(devtools(getStore, { enabled: process.env.NODE_ENV === 'development' })); Not sure why the relatively low-level type I also added this workaround to the demo https://stackblitz.com/edit/vitejs-vite-b4fksmbb?file=src%2Fstore.ts |
Beta Was this translation helpful? Give feedback.
-
Bug Description
I think #2875 created a Typescript issue. With 5.0.1, this code is perfectly fine:
But with 5.0.2, I get the following error:
(I would create a reproduction, but I've inherited this project and am not proficient enough with Zustand to do this without a stackblitz template or similar.)
For now, downgrading to 5.0.1 is the answer.
Reproduction Link
see above
Beta Was this translation helpful? Give feedback.
All reactions