Type does not flow properly when using the set
during creation
#2665
-
Bug DescriptionWith the following code:
The create with the The workaround only works if my
Which becomes very cumbersome. Even if this is the "norm", is there a better workaround? TypeScript: Reproduction Linkpasted |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
JS middleware and TS -> |
Beta Was this translation helpful? Give feedback.
-
BTW, you don't need to explicitly type your store, you can use create(
combine({ count: 0 }, (set) => ({
increment: () => {
set((state) => ({ count: state.count + 1 }));
},
})),
); |
Beta Was this translation helpful? Give feedback.
BTW, you don't need to explicitly type your store, you can use
combine
middleware to get fully inferred types ->