title: TypeScript namespace merging across files
body: <p>I'm having some issues with getting a namespace across files to resolve and compile properly.  According to <a href="https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Declaration%20Merging.md#merging-namespaces" rel="noreferrer">documentation</a> and this <a href="https://stackoverflow.com/questions/12787125/typescript-internal-modules-across-several-files">SO answer</a>, the following should produce no issue:</p>
  
  <p>App.Core.ts</p>
  
  <pre><code>namespace App.Core {
      export function createElem(tagName: string): JQuery {
          return $(document.createElement(tagName));
      }
  }
  </code></pre>
  
  <p>App.Core.SubModule.ts</p>
  
  <pre><code>/// &lt;reference path="App.Core.ts" /&gt;
  namespace App.Core.SubModule {
      export function Test(): JQuery {
          return App.Core.createElem("div");
  }
  </code></pre>
  
  <p>However, Visual Studio is giving me an error on the function call in <code>App.Core.SubModule.Test</code> stating <code>Property 'createElem' does not exist on type 'typeof Core'</code>  My understanding is that if a namespace is across multiple files TS compiler will automatically resolve those namespaces. It looks like the corresponding JavaScript is coming out correct however the lack of intellisense (and the red squiggle error line) is exceptionally frustrating and making me second guess what I'm writing.</p>
  
  <p>Is this an issue with my file setup, with TS compiler, or with Visual Studio 2015's apparently broken TypeScript intellisense functionalities right now?</p>