Autocomplete/intellisense/types for "actions" in defineStore() typed as "any" (missing)
See original GitHub issueYou can actually see this in the demo projects on stackblitz, when writing a func in actions, this
is typed as any
and doesn’t provide any autocomplete/intellisense/types
export const useCounter = defineStore({
id: 'counter',
state: () => ({
n: 2,
}),
getters: {
double: (state) => state.n * 2,
},
actions: {
increment(amount = 1) {
this.n += amount // this is "any", not typesafe
},
},
})
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Don't get autocomplete/intellisense when using "this" in store ...
According to the documentation I should get type support when writing "this" in store actions. Doesn't seem to work for me.
Read more >IntelliSense in Visual Studio Code
IntelliSense. IntelliSense is a general term for various code editing features including: code completion, parameter info, quick info, and member lists.
Read more >VSCode intellisense auto generate missing TypeScript type ...
When I create a new object: const button: Button = { // No Code Actions. } I don't have ...
Read more >IntelliSense completion for types & extension methods
How to use IntelliSense completion for types and extension methods that you haven't imported yet with a `using` directive.
Read more >How to type an object in Pinia state. Why unknown - r/vuejs
I have created an Interface called TeamInterface though I am unsure of how to set the type of the property to the Interface....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try setting
noImplicitThis
totrue
in your TS config.I was hitting this problem after refactoring a mono repo. The original package had the
strict: true
setting while the new one had not. Why is this necessary? I think this should be in the docs. It is hard to find the origin of this configuration error.