]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
refactor: missing devtoolhook type
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 3 May 2021 10:21:23 +0000 (12:21 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 3 May 2021 10:21:23 +0000 (12:21 +0200)
src/devtools.ts

index e1dacb38d7d975377743570214042ece68ade5df..f27464fde2d7649c562da96431dcd23532924443 100644 (file)
@@ -1,4 +1,25 @@
-import { DevtoolHook, StateTree, StoreWithState } from './types'
+import { StateTree, StoreWithState } from './types'
+
+interface DevtoolHook {
+  on(
+    event: string,
+    callback: (targetState: Record<string, StateTree>) => void
+  ): void
+  // eslint-disable-next-line @typescript-eslint/no-explicit-any
+  emit(event: string, ...payload: any[]): void
+}
+
+// add the __VUE_DEVTOOLS_GLOBAL_HOOK__ variable to the global namespace
+declare global {
+  interface Window {
+    __VUE_DEVTOOLS_GLOBAL_HOOK__?: DevtoolHook
+  }
+  namespace NodeJS {
+    interface Global {
+      __VUE_DEVTOOLS_GLOBAL_HOOK__?: DevtoolHook
+    }
+  }
+}
 
 const target =
   typeof window !== 'undefined'