mapStores,
ActionsTree,
} from './'
-import { App } from 'vue'
+import { App, ref, Ref } from 'vue'
declare module '../dist/pinia' {
export interface MapStoresCustomization {
export interface PiniaCustomProperties<Id, S, G, A> {
$actions: Array<keyof A>
myState: number
+
+ set canBeARef(value: number | Ref<number>)
+ get canBeARef(): number
}
export interface PiniaCustomStateProperties<S> {
expectType<number>(context.store.$state.myState)
expectType<number>(context.store.myState)
+ expectType<number>(context.store.canBeARef)
+ // it can be set to both a ref and a number
+ context.store.canBeARef = ref(2)
+ context.store.canBeARef = 3
+ // @ts-expect-error
+ context.store.canBeARef = 'eou'
+
return {
$actions: Object.keys(context.options.actions || {}),
}
upper: () => string
}>(mapState(useStore, ['a', 'upper']))
+// FIXME: @ts-expect-error
+mapState(useStore, ['a']).nested
+
expectType<{
newA: () => 'on' | 'off'
newUpper: () => string