Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining store with id as first parameter instead of inside options breaks WebStorm Intellisense in Vue templates #772

Closed
mousesama opened this issue Nov 4, 2021 · 0 comments

Comments

@mousesama
Copy link

Reproduction

Using WebStorm IDE, using defineStore() function to define a store using id as the first parameter and options object as second makes WebStorm not see any of the internal properties, getters, or actions in Intellisense when used in vue templates, it only sees the internal store values. In the script section, everything works as intended. Moving id into the options object makes Intellisense behave as expected.

Steps to reproduce the behavior

  1. Define store using
export const useMyStore = defineStore('myStore', {
    state: () => ({
        myVal: "value",
    }),
})
  1. Export store in script of vue component to use in template
export default defineComponent({
  name: "myComponent",
  setup() {
    const myStore = useMyStore()

    return {
      myStore
    }
  }
})
  1. Try to use the store in a template eg. <h1> {{ myStore.myVal }} </h1>
  2. WebStorm will complain that myVal does not exist in the object and Intellisense/autocomplete on myStore only results in showing internal store values (such as $patch)

Expected behavior

WebStorm will see and recognize my defined values of the store alongside the internal ones.

Actual behavior

WebStorm only sees internal store values

Additional information

I verified the problem exists using the latest Pinia version when using the new defineStore syntax. Moving the id back to the options menu as in the old syntax does not suffer from this problem.
See discussion: #531

@vuejs vuejs locked and limited conversation to collaborators Nov 4, 2021
@posva posva closed this as completed Nov 4, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants