title: Create a global variable in TypeScript
body: <p>In JavaScript I can just do this:</p>
  
  <pre><code> something = 'testing';
  </code></pre>
  
  <p>And then in another file:</p>
  
  <pre><code> if (something === 'testing')
  </code></pre>
  
  <p>and it will have <code>something</code> be defined (as long as they were called in the correct order).</p>
  
  <p>I can't seem to figure out how to do that in TypeScript.</p>
  
  <p>This is what I have tried.  </p>
  
  <p>In a .d.ts file:</p>
  
  <pre><code>interface Window { something: string; }
  </code></pre>
  
  <p>Then in my main.ts file:</p>
  
  <pre><code> window.something = 'testing';
  </code></pre>
  
  <p>then in another file:</p>
  
  <pre><code> if (window.something  === 'testing')
  </code></pre>
  
  <p><strong>And this works.  But I want to be able to lose the <code>window.</code> part of it and just have my <code>something</code> be global. Is there a way to do that in TypeScript?</strong></p>
  
  <p>(In case someone is interested, I am really trying to setup my logging for my application.  I want to be able to call <code>log.Debug</code> from any file without having to import and create objects.)</p>