From e04d09419144b313f653db762be0e04149fc68f5 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 3 May 2021 12:21:23 +0200 Subject: [PATCH] refactor: missing devtoolhook type --- src/devtools.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/devtools.ts b/src/devtools.ts index e1dacb38..f27464fd 100644 --- a/src/devtools.ts +++ b/src/devtools.ts @@ -1,4 +1,25 @@ -import { DevtoolHook, StateTree, StoreWithState } from './types' +import { StateTree, StoreWithState } from './types' + +interface DevtoolHook { + on( + event: string, + callback: (targetState: Record) => 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' -- 2.47.3