©TriMoon™©
Deno•11mo ago
©TriMoon™

globalThis woes with VSCode Deno extensions LSP

I'm having a hard time with the LSP 🤯

I have this code, which completes successful:
import { Debug } from "mods/Debug";
import { assertInstanceOf } from "@std/assert";

Deno.test("class Debug",
  async (t) => {
    await t.step("instanceof Map", () => {
      assertInstanceOf(new Debug(), Map);
    });
    await t.step("globalThis.debug instanceof Debug", () => {
      const _debug = new Debug();
      assertInstanceOf(
        // ts-ignore: we create it.
        globalThis.debug,
        Debug
      );
    });
  }
);

  • This is what the constructor of
    Debug
    does at moment: (See also: https://discord.com/channels/684898665143206084/1066309002771845202/1339300627301273612)
     constructor(...args) {
       super(args); // Let Map() do the initial conversion automatically.
       // Create the global debug member if non-existant yet.
       // @ts-ignore: See bottom of this file...
       globalThis.debug ??= this;
     }
  • But i'm getting this error in the problem reporter window, for the l
    debug
    in
    globalThis.debug
    , even though i used the comment above it
     Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
How do i get rid of this annoyance?
image.png
Was this page helpful?