From 8b2bf38eff3a97b9e21d87c1363dd24cb69872f5 Mon Sep 17 00:00:00 2001 From: xenticore Date: Fri, 28 Mar 2025 22:52:42 -0400 Subject: [PATCH] refactor: declare `GM_fetch` as global for typescript important for the compiler when mocking for unit tests --- global.d.ts | 7 +++++++ tsconfig.json | 1 + 2 files changed, 8 insertions(+) create mode 100644 global.d.ts diff --git a/global.d.ts b/global.d.ts new file mode 100644 index 0000000..d005f5b --- /dev/null +++ b/global.d.ts @@ -0,0 +1,7 @@ +export {}; + +declare global { + interface Window { + GM_fetch: typeof fetch; // or a more specific custom type + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index d459c51..8282a68 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,5 @@ { + "include": ["src/**/*", "declarations.d.ts", "global.d.ts"], "compilerOptions": { "outDir": "./dist/", "noImplicitAny": true,