typings for combine middleware
#2796
Unanswered
Nikaple
asked this question in
Bug report
Replies: 1 comment 4 replies
-
|
I think it's the same with v4. If it's not let us know. you need to type your function's argument explicitly: https://tsplay.dev/mLVrZw import { createStore } from "zustand/vanilla";
import { combine } from "zustand/middleware/combine";
const positionStore = createStore(
combine({ position: { x: 0, y: 0 } }, (set) => ({
setPosition: (position: { x: number; y: number }) => set({ position }),
})),
); |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Bug Description
I'm experimenting with the new 5.0 releases and have noticed that the
combinemiddleware lacks proper typing.Screenshot:

Reproduction Link
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYygUwIYzQZRtNOAXzgDMoIQ4AiALwFcBnGDAOwBMB6ANzeABt+GagG4AUKEixEKSgCNgrQiXKUaDZmy4hg7dvzQB3DOk7J5itKLFjzrZnEiNgMYBFZ4CcALwp0WXHx0AAoxOFkQBSVgpCcXN1YALhkAD2SABgAaOABPDOJibODGNBgASh8APjgYsPC4EpgABQhnV3dk4Lj21grvasaYx1b492IyzLqiMrKxMvFbdwcAEnYIGABhdxZLKB84NeR6EDRWGAA6AHNSgFEDE7OAIRyASXZQ8Oo1mABaOx2lFBqHM4BhGHAABIAFQAsgAZAAiwG4dzQDxg4jsK2++0Ox1OF2uMFR6Oeb2CX3W1AqYMhsMRyJJBIWq3WWzOGF25wwehu3AJcOAzFOaCgFMgimwUBAEH51CKaH5Zz61QQdW6CU86CupTwAWCZXOjRabQStXqcDScEVBPOyH4wAJAA1Jha8talRd7Y6zgBNV3jcTTBZY+DoDii5JNEwYE5SxgAHhgOTAaAgpGGpvcWrQRvockYqGAcjQlQA2ukALr7YosbAqxB1VkXZg5AznGBQNiMUjQKi+AAGne7QmwwWWCE02HOGvc5xSRDAKWyE6nudnrHOOUXKTKA6DC3D7FFXRGPRzOpgL1Y8Qw-D1Y4mmdGHiCuaJ19v97raAN8xsG4Xow+aFlAxa-keor-kAA
Beta Was this translation helpful? Give feedback.
All reactions