mrcrowl / vuex-typex

Typescript builder for strongly-typed access to Vuex Store modules
MIT License
193 stars 22 forks source link

Not an issue but of exemple of implementation in real project! #9

Closed victorgarciaesgi closed 5 years ago

victorgarciaesgi commented 6 years ago

Link to the module declarations

Module folder; Store declaration Store init

In component usage exemple

Usage in other files exemple

Hope it helps those who want to test this lib I really love it!

Gregoyle commented 6 years ago

I was looking through your code and one thing confused me. In your Global Store you type the context of your actions as async function fetchPaths(context: GlobalContext, svgPath: string) { but in other modules you don't type the context in actions. Why do you, in that call, call context.commit rather than as you do in the other calls, to Mutations.mutations.someCall?

Also, your work is great! I'm having a problem emulating it to a point though because in some instances when I try to use context in an action to commit for instance I get a TS Error about BareContext and ActionContext being incompatible.

victorgarciaesgi commented 6 years ago

@Gregoyle Hi! Thanks for looking into it. I struggled myself to put this in place so I understand that you have problems emulating it ! For the GlobalStore that was an old context commit I forgot to change, If you look into LoginStore for exemple you will see I always use Mutations.mutations.someCall. But i think you just need to put the parameter in place so the typings works. That was a choice of myself to use namespaces like this and I don't know if it's good practice so if you find a better and proper solution don't forget to notify me! :) Also if you have other questions on my code I'm here

Gregoyle commented 6 years ago

@victorgarciaesgi

Hi Victor, I'm wondernig if you ever ran into this issue? https://github.com/mrcrowl/vuex-typex/issues/11