ktsn / vuex-class

Binding helpers for Vuex and vue-class-component
MIT License
1.73k stars 86 forks source link

typescript cannot infer type #51

Closed GopherJ closed 5 years ago

GopherJ commented 5 years ago

Questions

Typescript cannot infer correctly the type, am I wrong somewhere?

Screenshot from 2019-03-30 13-00-47

austindebruyn commented 5 years ago

This fixed it for me: https://github.com/ktsn/vuex-class/issues/33#issuecomment-433074018

Try @AclModule.Mutation(UPDATE_ACL_FILTER) updateAclFilter!: () => void;

GopherJ commented 5 years ago

@austindebruyn Thanks! It works like a charm!

kamok commented 5 years ago

Why can't we use TypeScript implicit typing? We have access to the Actions and its typing. Is there a way to make it work?

StummeJ commented 4 years ago

Because of decorators not being able to set the type of what it's decorating.... Composition API gives you the ability to infer types.