So, I was applying all the wisdom in here, to my quite large vuex stack, and IÂ stumbled upon the second argument of Getters (I leave the third and fourth to the reader)
Basically, the second argument to Getters references the Getters for the current namespace, but not as functions, as values directly.
The problem is that the getters argument as an "any" type everywhere, IÂ tried to put the Getters type, but that was not right. After a bit of fiddeling around (I am still a bit new and rough in typescript)Â IÂ ended up having this :
The naming is probably awful, and now that I think about it, one should just have to generate a Getters that is, say, user: PayloadUser; roles:Â string[]; and a different kind of fiddeling be done so that the type with the function definitions can be generated automatically.
Also, if all this goes into a module somewhere, this should probably get there too.
So, I was applying all the wisdom in here, to my quite large vuex stack, and IÂ stumbled upon the second argument of Getters (I leave the third and fourth to the reader)
Basically, the second argument to Getters references the Getters for the current namespace, but not as functions, as values directly.
For example, I have this:
The problem is that the getters argument as an "any" type everywhere, IÂ tried to put the
Getters
type, but that was not right. After a bit of fiddeling around (I am still a bit new and rough in typescript)Â IÂ ended up having this :The naming is probably awful, and now that I think about it, one should just have to generate a
Getters
that is, say,user: PayloadUser; roles:Â string[];
and a different kind of fiddeling be done so that the type with the function definitions can be generated automatically.Also, if all this goes into a module somewhere, this should probably get there too.
So, I thought about what I wrote in the end and changed my code, it now reads: