title: Typescript: .d.ts file not recognized
body: <p>This one's probably extremely simple but I'm going nuts trying to figure it out.</p>
  
  <p>I have a very simple self-executing function in an outer index.ts file that needs to register a global variable on the window object. I want to assign it like so:</p>
  
  <pre><code>(() =&gt; {
    window.myCustomGlobal = new MyCustomGlobal();
  })()
  </code></pre>
  
  <p>I created index.d.ts alongside index.ts:</p>
  
  <pre><code>import { MyCustomGlobal} from './classes';
  
  declare interface Window {
    myCustomGlobal: MyCustomGlobal;
  }
  </code></pre>
  
  <p>No errors in the above, all looks good. The application compiles fine.</p>
  
  <p>In the IDE, however, I get an error:
  <code>ts2339: Property 'myCustomGlobal' does not exist on type 'Window'</code></p>
  
  <p>I can't for the life of me figure out what exactly makes Typescript "figure out" what .d.ts file to include. In certain libs, having a .d.ts file alongside a .js file causes it to get picked up, and it works fine. In fact, I used the <em>exact same interface as above</em> with a global third-party lib and it worked great; it just seems like my IDE won't pick it up.</p>
  
  <p>I've tried adding <code>index.d.ts</code> to tsconfig.json in <code>include</code> as well as <code>files</code> with no luck.</p>
  
  <p>Can somebody explain, as if to a child, what causes TS to pick up declaration files? Some days I feel like I get it, and then in stupid simple examples like this I feel like an idiot.</p>
  
  <p>Thanks</p>