From e0fd6c984049e74350ff1dc4472f21b91db3291a Mon Sep 17 00:00:00 2001 From: Yourim Cha <81357083+chacha912@users.noreply.github.com> Date: Tue, 4 Jun 2024 10:41:05 +0900 Subject: [PATCH] Add conditional checks for `window` object (#839) --- src/devtools/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/devtools/index.ts b/src/devtools/index.ts index 31e1020fb..5a30162fc 100644 --- a/src/devtools/index.ts +++ b/src/devtools/index.ts @@ -34,7 +34,14 @@ const unsubsByDocKey = new Map void>>(); * IndexedDB will be used. */ const transactionEventsByDocKey = new Map>(); -(window as any).transactionEventsByDocKey = transactionEventsByDocKey; +declare global { + interface Window { + transactionEventsByDocKey: Map>; + } +} +if (typeof window !== 'undefined') { + window.transactionEventsByDocKey = transactionEventsByDocKey; +} /** * `sendToPanel` sends a message to the devtools panel.