Hey Andrew, thanks for this great example. I am currently stuck in the process of typing getters, rootState, and rootGetters in actions and getters. Any chance that you can share an example? I guess the AugmentedActionContext and Store type definitions is what I am looking for.
Hey Sergej, Thanks. You have to manually create MODULE_NAME/MUTATION_TYPE mappings by now. But if you are using TS 4.1 you can use Template Literal Types.
Here is the snippet from the helper library I am developing right now:
Wow! I totally didn't expect that this article will be popular. Thank you for your comments.
According to the comments I've read, here is what I'm planning to include:
namespaced
modules;What do you think of idea of creating a dedicated package with helper types (
MutationTree
,GetterTree
,ActionTree
,Store
)?I also managed to type
getters
,rootState
,rootGetters
inactions
andgetters
.Stay tuned.
Hey Andrew, thanks for this great example. I am currently stuck in the process of typing getters, rootState, and rootGetters in actions and getters. Any chance that you can share an example? I guess the AugmentedActionContext and Store type definitions is what I am looking for.
Thank You
As a reference, I've uploaded a gist here: gist.github.com/soerenmartius/5f69...
The code works but typescript is unable to resolve the getters properly. Any help will be highly appreciated
Thank you very march for great article!
You promice to add some new code as you described above.
May be you have any news about it ?
Hey Andrew, any thoughts on the namespaced modules yet? Great guide otherwise!
Hey Sergej, Thanks. You have to manually create
MODULE_NAME/MUTATION_TYPE
mappings by now. But if you are using TS4.1
you can use Template Literal Types.Here is the snippet from the helper library I am developing right now:
I see, nice trick, thanks, Andrew!
Hi @3vilarthas
Did you share the update avoid the Types for rootState? I would like to see this resource. Thanks in advance!