From 84a15ec9c325539ece3a18c626bad2e14b4903aa Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 13 May 2021 13:36:33 +0200 Subject: [PATCH] refactor: fix cherry picking --- src/mapHelpers.ts | 3 ++- src/plugin.ts | 2 +- src/rootStore.ts | 7 +++---- src/store.ts | 6 +++--- src/types.ts | 2 +- test-dts/state.test-d.ts | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mapHelpers.ts b/src/mapHelpers.ts index bddb18a4..df231757 100644 --- a/src/mapHelpers.ts +++ b/src/mapHelpers.ts @@ -5,6 +5,7 @@ import { StateTree, Store, StoreDefinition, + ActionsTree, } from './types' type ComponentPublicInstance = Vue @@ -57,7 +58,7 @@ function getCachedStore< Id extends string = string, S extends StateTree = StateTree, G extends GettersTree = GettersTree, - A = Record + A = ActionsTree >( vm: ComponentPublicInstance, useStore: StoreDefinition diff --git a/src/plugin.ts b/src/plugin.ts index c9f68a8e..41570c91 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -1,4 +1,4 @@ -import { PluginFunction } from 'vue' +import type { PluginFunction } from 'vue' import { piniaSymbol } from './rootStore' /** diff --git a/src/rootStore.ts b/src/rootStore.ts index 9f8dfbd7..41abe40b 100644 --- a/src/rootStore.ts +++ b/src/rootStore.ts @@ -4,13 +4,12 @@ import { StoreWithState, StateDescriptor, PiniaCustomProperties, - GenericStore, GettersTree, - _Method, Store, DefineStoreOptions, + ActionsTree, } from './types' -import { VueConstructor } from 'vue' +import type { VueConstructor } from 'vue' import type Vue from 'vue' /** @@ -42,7 +41,7 @@ export interface PiniaPluginContext< Id extends string = string, S extends StateTree = StateTree, G extends GettersTree = GettersTree, - A = Record + A = ActionsTree > { /** * pinia instance. diff --git a/src/store.ts b/src/store.ts index 535baa43..78e7529d 100644 --- a/src/store.ts +++ b/src/store.ts @@ -251,7 +251,7 @@ function buildStoreToUse< Id extends string, S extends StateTree, G extends GettersTree, - A extends Record + A extends ActionsTree >( partialStore: StoreWithState, descriptor: StateDescriptor, @@ -384,7 +384,7 @@ export function defineStore< storeAndDescriptor[1], id, getters as GettersTree | undefined, - actions as Record | undefined, + actions as ActionsTree | undefined, // @ts-expect-error: because of the extend on Actions options ) @@ -405,7 +405,7 @@ export function defineStore< storeAndDescriptor[1], id, getters as GettersTree | undefined, - actions as Record | undefined, + actions as ActionsTree | undefined, // @ts-expect-error: because of the extend on Actions options ) diff --git a/src/types.ts b/src/types.ts index 7ccdca1a..6ba83e9a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -378,7 +378,7 @@ export interface PiniaCustomProperties< Id extends string = string, S extends StateTree = StateTree, G extends GettersTree = GettersTree, - A = Record + A = ActionsTree > {} /** diff --git a/test-dts/state.test-d.ts b/test-dts/state.test-d.ts index ed2a975a..4c9d6ec3 100644 --- a/test-dts/state.test-d.ts +++ b/test-dts/state.test-d.ts @@ -1,4 +1,4 @@ -import { computed, ref } from 'vue' +import { computed, ref } from '@vue/composition-api' import { defineStore, expectType } from './' const name = ref('Eduardo') -- 2.47.3