]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
fix(types): for devtools-api
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 3 Nov 2021 19:00:28 +0000 (20:00 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Wed, 3 Nov 2021 19:00:28 +0000 (20:00 +0100)
packages/pinia/src/createPinia.ts
packages/pinia/src/devtools/plugin.ts
packages/pinia/src/vue2-plugin.ts

index acd9761243a5f2cc01fef85ebd2c45f48b48f846..4a1522ca60d9c472604a79ba738f2b37afdbab4a 100644 (file)
@@ -28,6 +28,7 @@ export function createPinia(): Pinia {
         app.config.globalProperties.$pinia = pinia
         /* istanbul ignore else */
         if (__DEV__ && IS_CLIENT) {
+          // @ts-expect-error: weird type in devtools api
           registerPiniaDevtools(app, pinia)
         }
         toBeInstalled.forEach((plugin) => _p.push(plugin))
index 148db2ce05b1f4b6a485289db6527400d1f7415c..c62e660d0bddc105b2fdc4587ce9c5f78fb6ed7d 100644 (file)
@@ -1,12 +1,9 @@
-import { setupDevtoolsPlugin, TimelineEvent } from '@vue/devtools-api'
 import {
-  App,
-  ComponentPublicInstance,
-  markRaw,
-  toRaw,
-  unref,
-  watch,
-} from 'vue-demi'
+  setupDevtoolsPlugin,
+  TimelineEvent,
+  App as DevtoolsApp,
+} from '@vue/devtools-api'
+import { ComponentPublicInstance, markRaw, toRaw, unref, watch } from 'vue-demi'
 import { Pinia, PiniaPluginContext } from '../rootStore'
 import {
   _GettersTree,
@@ -54,7 +51,7 @@ const getStoreType = (id: string) => '🍍 ' + id
  * @param app - Vue application
  * @param pinia - pinia instance
  */
-export function registerPiniaDevtools(app: App, pinia: Pinia) {
+export function registerPiniaDevtools(app: DevtoolsApp, pinia: Pinia) {
   setupDevtoolsPlugin(
     {
       id: 'dev.esm.pinia',
@@ -246,7 +243,7 @@ export function registerPiniaDevtools(app: App, pinia: Pinia) {
   )
 }
 
-function addStoreToDevtools(app: App, store: StoreGeneric) {
+function addStoreToDevtools(app: DevtoolsApp, store: StoreGeneric) {
   if (!componentStateTypes.includes(getStoreType(store.$id))) {
     componentStateTypes.push(getStoreType(store.$id))
   }
@@ -509,6 +506,7 @@ export function devtoolsPlugin<
   }
 
   addStoreToDevtools(
+    // @ts-expect-error: should be of type App from vue
     app,
     // FIXME: is there a way to allow the assignment from Store<Id, S, G, A> to StoreGeneric?
     store as StoreGeneric
index 1b3bde6bf192275617bd03d5ae301e4af75ad4da..42b9426efea761c3e2f5bbb32087da766602ce26 100644 (file)
@@ -57,6 +57,7 @@ export const PiniaVuePlugin: Plugin = function (_Vue) {
           // installing pinia's plugin
           setActivePinia(pinia)
           if (__DEV__) {
+            // @ts-expect-error: weird type in devtools api
             registerPiniaDevtools(pinia._a, pinia)
           }
         }