]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
test: Store suffix customization
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 28 Apr 2021 17:41:11 +0000 (19:41 +0200)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Wed, 28 Apr 2021 17:45:38 +0000 (19:45 +0200)
test-dts/customizations.test-d.ts

index 56e180563f682220102397ebf757dafc6abdfefe..c4aaf6d4322b32fb0e840f79c7e27592e33011a9 100644 (file)
@@ -1,7 +1,12 @@
+import { mapStores } from 'dist/pinia'
 import { App } from 'vue'
 import { expectType, createPinia, defineStore } from '.'
 
 declare module '../dist/pinia' {
+  export interface MapStoresCustomization {
+    suffix: 'Store'
+  }
+
   export interface PiniaCustomProperties<Id, S, G, A> {
     $actions: Array<keyof A>
   }
@@ -26,8 +31,8 @@ pinia.use((context) => {
   }
 })
 
-defineStore({
-  id: 'a',
+const useStore = defineStore({
+  id: 'main',
   actions: {
     one() {},
     two() {
@@ -51,6 +56,10 @@ function debounce<F extends Procedure>(fn: F, time: number = 200) {
   return fn
 }
 
+expectType<{
+  mainStore: () => ReturnType<typeof useStore>
+}>(mapStores(useStore))
+
 pinia.use(({ options, store }) => {
   if (options.debounce) {
     return Object.keys(options.debounce).reduce((debouncedActions, action) => {