title: Compiler fails to import type from global.d.ts
body: <p><a href="https://github.com/bigfont/StackOverflow/tree/master/TypeScriptGlobalTypeDeclarations" rel="nofollow noreferrer">Here is the full NPM package on GitHub.</a></p>
  
  <p>tsconfig.json</p>
  
  <pre><code>{
    "compilerOptions": {
      "target": "es5",
      "module": "commonjs"
    }
  }
  </code></pre>
  
  <p>global.d.ts</p>
  
  <pre><code>interface Foo { }
  </code></pre>
  
  <p>index.ts</p>
  
  <pre><code>const x: Foo = {};
  </code></pre>
  
  <p>This is what happens when we build:</p>
  
  <pre><code>$ \node_modules\.bin\tsc .\index.ts
  index.ts(1,10): error TS2304: Cannot find name 'Foo'.
  </code></pre>
  
  <p>This is our version:</p>
  
  <pre><code>$ .\node_modules\.bin\tsc --version
  Version 2.3.4
  </code></pre>
  
  <p>These are the files that tsc lists: </p>
  
  <pre><code>$ .\node_modules\.bin\tsc --listFiles
  C:/temp/node_modules/typescript/lib/lib.d.ts
  C:/temp/global.d.ts                         
  C:/temp/index.ts                           
  </code></pre>
  
  <p>How can we automatically load <code>Foo</code> into the index.ts file? </p>
  
  <h2>Research</h2>
  
  <p><a href="https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-d-ts.html" rel="nofollow noreferrer">The documentation on global.d.ts</a> indicates that the above should work.</p>