title: Merging two exported modules
body: <p>I'm unsure about how to go about this, perhaps I'm doing it wrong.  I need to spread the SAME module ('A') across <em>different</em> files (TypeScript's JS output shows they will "merge" as they execute). Examples:</p>
  
  <pre><code>---File1.ts---
  export module A { export class X { } }
  
  ---File2.ts---
  export module A { export class Y extends X { } }
  </code></pre>
  
  <p>This of course wraps the modules in a "define()" function, but A.X in file2 shows an error in Visual Studio that it doesn't exist (and the intellisense doesn't show it).  Is it possible to do this as shown above? I'm aware I have to use "import varname = require(...);", but that doesn't seem to help any.</p>
  
  <p>BTW: I'm aware of using references, and it doesn't help.</p>
  
  <p>See here for an example: <a href="http://goo.gl/zlVKRv" rel="nofollow">http://goo.gl/zlVKRv</a>  - The JS code clearly shows support for loading multiple modules of the same name for combination, so I'm not sure why the compiler and intellisense won't work.  Seems like a bug to me.</p>
  
  <p>Just to reiterate: The main issue is that I need the compiler and intellisense to "see" the dependent modules as one from file2.</p>
  
  <p>What I was hoping to do was something like this:</p>
  
  <pre><code>import mod = require("test1");
  import A = mod.A;
  
  export module A {
      export class Y extends X {
      }
  }
  </code></pre>
  
  <p><strong>Update 1:</strong> Submitted this related request to have this process above working, or at least something similar:
  <a href="https://typescript.codeplex.com/workitem/1846" rel="nofollow">https://typescript.codeplex.com/workitem/1846</a></p>
  
  <p><strong>Update 2:</strong> Seems this ability is on the team's radar! 8)  A real answer should come in due time.</p>