Closed paulvanbladel closed 5 years ago
Hi @paulvanbladel , thanks again for the feedback! I never tried with js I didn"t even know it worked :) Looking into it!
Do you have an exemple of your problem? I have no problem with having getters on my module, must me coming for the @ts-check option ? Try writing your files in TS instead :)
Sure, here is a demo of the problem: https://github.com/paulvanbladel/ItemsJs-Vue-Demo/blob/master/app/src/pages/store-demo.vue
try putting the getters in comment, you will see type inference works as expected. Comment them out, and type inference fails for the whole file.
The problem comes from your second getter, which triggers a loop in the infered types
testGetter2 () {
return testModule.state.myProp
}
Either declare a const getters outside of the constructor, or refer to the state!
const getters = {
testGetter2 () {
return testModule.state.myProp
}
}
Of course ! Thanks a lot Victor. You know, this is the only library which provides intellisense and type inference combined with ES 6 ! I prefer to start using typescript when there is more certainty about the Vue composition API (so Vue 3).
@paulvanbladel Thanks for your kinds words, that's why i created it in the first place, I wanted 0 boilerplate for typing Vuex! :)
When you have, a VuexModule without getters, intellisense is working fine (even in js files with the //@ts-check.
As you can see:
When you add now a getter, the type inference is completely broken.