DEV Community

Discussion on: Vuex + TypeScript

Collapse
 
mohandeblaze profile image
Mohan R

Great post. I’m curious that everything you did is just TypeScript things except defining global $store type, so isn’t possible to do the same in Vue 2 + Vuex 3 and have a fully typed store?

Collapse
 
3vilarthas profile image
Andrew

What we did in our project is that we just removed the global vuex types/vue.d.ts files, and used the approach with Vue 2.x. Take a look at npm-patch-package. Then you can just comment out these lines and apply the patch. That's it, you can type the store in 2.x.

I also like the idea that API and code stay the same, we just enhance typings.