From f790e6aaf9ba9c3fb17f36e813939340f53af06a Mon Sep 17 00:00:00 2001 From: makhnatkin Date: Tue, 3 Sep 2024 18:06:03 +0200 Subject: [PATCH] feat: added TODO --- .eslintignore | 1 - src/lib/extension-load-queue.ts | 17 +++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.eslintignore b/.eslintignore index 75fa010..3a3a9bc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,7 +5,6 @@ .DS_Store node_modules /lib -/react /dist /build /cache diff --git a/src/lib/extension-load-queue.ts b/src/lib/extension-load-queue.ts index e0cef5c..0a4fe24 100644 --- a/src/lib/extension-load-queue.ts +++ b/src/lib/extension-load-queue.ts @@ -1,13 +1,5 @@ import {useEffect, useState} from 'react'; -declare global { - interface Window { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - [key: symbol]: any; - QUEUE_SYMBOL: boolean; - } -} - export type ControllerLoadedCallback = (controller: T) => void; export const QUEUE_SYMBOL = Symbol.for('queue'); @@ -25,6 +17,7 @@ export interface CreateLoadQueueArgs { // so we should place it in a separate top-level file and document it. export const isBrowser = () => typeof window !== 'undefined' && typeof document !== 'undefined'; +// TODO: window casts are weird — fix encounter any issues with declaration merging export const getScriptStore = (key: symbol): ScriptStore => { if (isBrowser()) { (window as Window)[key] = (window as Window)[key] || []; @@ -116,3 +109,11 @@ export function useController(store: ScriptStore) { return controller; } + +declare global { + interface Window { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + [key: symbol]: any; // TODO: sub-optimal, fix any + QUEUE_SYMBOL: boolean; + } +}