danielroe/typed-vuex

fix: namespaced property breaks code completion for modules in template in Webstorm

daniluk4000 opened this issue ยท 4 comments

๐Ÿ› The bug
When using namespaced property in modules code completion breaks for all modules in template

Possible Nuxt-only, possible Webstorm-only (works fine in <scripts>

๐Ÿ› ๏ธ To reproduce
Steps to reproduce the behavior:

  1. Open Webstorm
  2. Write submodule call in template section, see TS works
  3. Add namespaced: true to any other submodule
  4. Code completion breaks

๐ŸŒˆ Expected behaviour
Code completion works fine

I can see possible fix for this, works fine for me locally

export interface NuxtStore {
  state: State
  getters: Record<string, any>
  mutations: Record<string, any>
  actions: Record<string, any>
  modules: NuxtModules
  //Need to add this. Not sure if must be optional though
  namespaced?: boolean
}

Would you give an example of the kind of code that doesn't work?

I've managed to reproduce issue in clear project.

https://github.com/daniluk4000/typed-vuex-webstorm-bug

Please try to use autocompletion in pages/index.vue for submodule and regular example property. Doesn't work for me in template, works fine in scripts section.

And then try to do the same with removing namespaced property from store/index.ts. Completion starts working for me after this.

I've also created PR that resolves issue for me.

I have also noticed this error with using strict property with spread operator (required in some cases for dynamic modules from #267), added a fix