Immer Middelware Typescript error: Exported variable 'useMyStore' has or is using name 'WritableDraft' from external module "../node_modules/immer/dist/immer" but cannot be named. #2429
Unanswered
rohitspujari
asked this question in
Q&A
Replies: 2 comments 2 replies
-
@rohitspujari would you mind sharing us a minimal repro on stackblitz? |
Beta Was this translation helpful? Give feedback.
0 replies
-
@dbritto-dev (and @rohitspujari ?) here is a repro... I get the same issue... https://github.com/jessekrubin/zustand-middleware-immer-writeable-draft-tsc |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I add an array property of a custom type like
Cites: City[]
, the build fails with the error above. But if I useCity: any[]
, or a singular property like string or even a singular custom typecity: City
, it works fine.Here is how I configured my store
export const useMyStore = create<MyStore>()( immer((set, get) => ({ ... }))
I'm using Vite for the build.
Beta Was this translation helpful? Give feedback.
All reactions