import { App } from 'vue'
declare module '../src' {
- export interface PiniaCustomProperties {
+ export interface PiniaCustomProperties<Id> {
n: number
uid: App['_uid']
hasApp: boolean
+ idFromPlugin: Id
}
}
expect(store.uid).toBeDefined()
// @ts-expect-error: n is a number
store.n.notExisting
+ // @ts-expect-error: it should always be 'test'
+ store.idFromPlugin == 'hello'
})
it('can install plugins before installing pinia', () => {
S &
StoreWithGetters<G> &
StoreWithActions<A> &
- PiniaCustomProperties
+ PiniaCustomProperties<Id, S, G, A>
/**
* Generic store type
/**
* Properties that are added to every store by `pinia.use()`
*/
-export interface PiniaCustomProperties {}
+export interface PiniaCustomProperties<
+ Id extends string = string,
+ S extends StateTree = StateTree,
+ G = Record<string, Method>,
+ A = Record<string, Method>
+> {}