title: How to prevent "Property '...' does not exist on type 'Global'" with jsdom and typescript?
body: <p>I try to convert an existing project to use Typescript and I have problems doing so with my testing setup.</p>
  
  <p>I had a setup file for my tests that sets up jsdom so that all my DOM interacting code works during my tests. Using Typescript (ts-node with mocha) I always get errors like this:</p>
  
  <pre><code>Property 'window' does not exist on type 'Global'.
  </code></pre>
  
  <p>To prevent this I tried patching the NodeJS.Global interface like this:</p>
  
  <pre><code>declare namespace NodeJS{
    interface Global {
      document: Document;
      window: Window;
      navigator: Navigator;
    }
  }
  </code></pre>
  
  <p>But this didn't change anything.</p>
  
  <p>How do I enable those browser properties on the NodeJS global variable?</p>
  
  <p><strong>Extras:</strong></p>
  
  <p>This is my mocha <code>setup.ts</code>:</p>
  
  <pre><code>import { jsdom, changeURL } from 'jsdom';
  
  const exposedProperties = ['window', 'navigator', 'document'];
  
  global.document = jsdom('');
  global.window = global.document.defaultView;
  Object.keys(global.document.defaultView).forEach((property) =&gt; {
    if (typeof global[property] === 'undefined') {
      exposedProperties.push(property);
      global[property] = global.document.defaultView[property];
    }
  });
  
  global.navigator = {
    userAgent: 'node.js',
  };
  
  changeURL(global.window, 'http://example.com/');
  </code></pre>