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.
rohitspujari opened this issue · comments
Rohit commented
When I add an array property of a custom type like Cites: City[]
, the build fails with the error above. But if I use City: any[]
, or a singular property like string or even a singular custom type city: 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.