No typing/autocomplete for store's own properties
See original GitHub issueReproduction
When writing a store, I noticed I’m not actually getting any type info/autocompletion for internal state/getters/actions accessed on this
, however, I do get completion for imported stores. I’m not 100% sure if this is intentional or not.
Steps to reproduce the behavior
A simple example:
import { useOtherStore } from '@/stores/useOtherStore'
import { Fruit } from '@/types'
export const useSampleStore = defineStore({
id: 'sample',
state() {
return { fruits: [] as Fruit[] }
},
getters: {
computedFruits() {
const otherStore = useOtherStore()
const otherData = otherStore.someData // has typing/autocomplete
this.fruits.push(otherData) // this.fruits is showing as "any" type
}
}
})
Expected behavior
Referenced state/actions/getters inside a store on this
would have correct typings
Actual behavior
Internal state/actions/getters shows up as any
Additional information
- Using the latest stable version of VSCode with Vetur
- Pinia version:
2.0.0-alpha.10
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Grocery Stores and Supermarkets For Sale - BizBuySell
Browse 551 Grocery Stores and Supermarkets currently available for sale on BizBuySell today to find the opportunity that's right for you!
Read more >Grocery Stores and Supermarkets For Sale - LoopNet
View 523 Grocery Stores and Supermarkets for sale on LoopNet.com. Search LoopNet for Grocery Stores and Supermarkets for sale as well as other...
Read more >Start Your Own Retail Grocery Business | Save A Lot Licensing
There's never been a better time to start a retail grocery business. Save A Lot helps our retail partners break into the industry...
Read more >Store Leasing Available Properties - NYCHA - NYC.gov
Available Stores for Rent. Listings marked with an * currently have an application in process. Manhattan. First Houses (Store #4)
Read more >Investors are betting on grocery real estate
Walmart even operates its own real estate arm, Walmart Realty. Some retailers prefer not to be encumbered by non-core assets, ...
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
No problem, I’ll try it again tomorrow, sorry for the hassle! Really loving Pinia so far 😍
Can you provide a reproduction? The tests are passing: https://github.com/posva/pinia/blob/v2/test-dts/store.test-d.ts#L8