Augmentations for the global scope can only be directly nested in external modules or ambient module declarations(2669) : <p>I would like to store my NodeJS config in the global scope.</p>

<p>I tried to follow this => <a href="https://stackoverflow.com/questions/35074713/extending-typescript-global-object-in-node-js">Extending TypeScript Global object in node.js</a> and other solution on stackoverflow, </p>

<p>I made a file called global.d.ts where I have the following code </p>

<pre><code>declare global {
    namespace NodeJS {
      interface Global {
          config: MyConfigType
      }
    }
  }
</code></pre>

<blockquote>
  <p>Augmentations for the global scope can only be directly nested in
  external modules or ambient module declarations.ts(2669)</p>
</blockquote>

<p>but doing this works fine =></p>

<pre><code>declare module NodeJS  {
    interface Global {
        config: MyConfigType
    }
}
</code></pre>

<p>the problem is, I need to import the file <code>MyConfigType</code> to type the config, but the second option do not allow that.</p>
