title: How to declare a global, globalThis in Typescript?
body: <p>I've been googling to find some updated answer on how to declare globals in Typescript. But I'm not sure which tutorial/guide has the most updated solution.</p>
  
  <p>Anyhow I'm trying to get my custom global declares <code>d.ts</code> to work.
  Right now I've setup so that my Typescript project is built and bundled using webpack/ts-loader.</p>
  
  <p>My tsconfig.json file looks as following. Guides I've read said things that I don't really need to set <code>typeRoots</code> as Typescript can find the types by it self. I've tried with and without anyhow, and both resulted in the same. </p>
  
  <pre><code>{
      "files": [
          "app.ts",
      ],
      "compilerOptions": {
          "emitDecoratorMetadata": true,
          "experimentalDecorators": true,
          "module": "commonjs",
          "moduleResolution": "node",
          "noImplicitAny": false,
          "target": "es5",
          "declaration": false,
          "sourceMap": true,
          "skipLibCheck": true,
          "lib": ["es6", "dom"],
          "esModuleInterop": true,
          "typeRoots": [
              "./typings/",
              "../../../../../node_modules/@types/"
          ]
      }
  }
  </code></pre>
  
  <p>And my <code>d.ts</code> file which I named to <code>soho.d.ts</code> contains the following</p>
  
  <pre><code>declare global {
      namespace Soho {
  
      }
      interface Window {
          Soho: Soho;
      }
  
      interface Soho {
          Locale: any;
      }
  }
  </code></pre>
  
  <p>I get the following error though in webpack</p>
  
  <pre><code>TS2304: Cannot find name 'Soho'
  </code></pre>
  
  <p>In the code I'm trying to use my global as following</p>
  
  <pre><code>Soho.Locale
  </code></pre>
  
  <p>Did I set my <code>tsconfig.json</code> file correct, or is it something wrong with my <code>d.ts</code> file?</p>