From: Eduardo San Martin Morote Date: Mon, 3 May 2021 10:21:23 +0000 (+0200) Subject: refactor: missing devtoolhook type X-Git-Tag: v0.4.0~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e04d09419144b313f653db762be0e04149fc68f5;p=thirdparty%2Fvuejs%2Fpinia.git refactor: missing devtoolhook type --- 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'