title: Issue creating a single .d.ts when using external modules
body: <p>I'm developing an NPM package using typescript. Within this package the TS files are setup as external modules. The compiler won't generate a single .d.ts for external modules. I'm trying to concat all tsc generated type definitions into a single .d.ts for the entire package. </p>
  
  <p>I'm having issues laying out the single .d.ts file (following a similar approach to that used in <code>grunt-dts-bundle</code>). The condensed example below captures my issue.</p>
  
  <p>Given this external module declaration and test file:</p>
  
  <p><code>test.d.ts</code> :</p>
  
  <pre><code>declare module "ExternalWrapper" {
      export import Foo = require("FooModule");
  }
  
  declare module "FooModule" {
      class Foo {
          name: string;
      }
       export = Foo;
  }
  </code></pre>
  
  <p><code>test.ts</code>:</p>
  
  <pre><code>import externalWrapper = require( 'ExternalWrapper' );
  var t = new externalWrapper.Foo();
  </code></pre>
  
  <p>Running <code>tsc test.ts test.d.ts -m commonjs</code> produces this error: <code>TS2083: Invalid 'new' expression.</code></p>
  
  <p>If you change 'test.ts' to look like this, importing 'FooModule' directly:</p>
  
  <pre><code>import Foo = require( "FooModule" );
  var t = new Foo();
  </code></pre>
  
  <p>It compiles fine.</p>
  
  <p>The compiler understands the type <code>externalWrapper.Foo</code> however it doesn't seem to represent it as the same type <code>FooModule.Foo</code>. There is something I'm not getting about how the compilers handles modules that are exported via 'export import'. </p>
  
  <p>Failing the above I'll probably look to manually creating the .d.ts :( </p>
  
  <p>Any help appreciated.</p>