title: TypeScript not merging namespaces from multiple files
body: <p>I've imported types with <code>typings</code> and need to extend some of them with additional method definitions. For example, I have this file for <code>Mocha</code>:</p>
  
  <pre><code>// /typings/globals/mocha/index.d.ts
  
  declare namespace Mocha {
  
      interface IRunnable {
          title: string;
          fn: Function;
          async: boolean;
          sync: boolean;
          timedOut: boolean;
      }
  
      interface ITest extends IRunnable {
          parent: ISuite;
          pending: boolean;
          state: 'failed'|'passed'|undefined;
  
          fullTitle(): string;
      }
  }
  </code></pre>
  
  <p>I need to add a method to <code>IRunnable</code> and an overload to <code>ITestDefinition</code>. In this case the typing is wrong--the method exists but is not in the type declaration. So I tried adding a separate file</p>
  
  <pre><code>// /typings/global/custom-additions/index.d.ts
  
  declare namespace Mocha {
  
      interface IRunnable {
          timeout(value:boolean):void;
      }
  
      interface ITestDefinition {
          (expectation: string, callback?: () =&gt; void): Mocha.ITest;
      }
  }
  </code></pre>
  
  <p>This gives me an error in custom-additions itself:</p>
  
  <blockquote>
    <p>custom-additions/index.d.ts(420,65): error TS2694: Namespace '".../custom-additions/index".Mocha' has no exported member 'ITest'.</p>
  </blockquote>
  
  <p>And also an error when trying to reference the added <code>timeout()</code> method:</p>
  
  <blockquote>
    <p>tests/runner.ts(65,31): error TS2339: Property 'timeout' does not exist on type 'ITest'.</p>
  </blockquote>
  
  <p>At the top of <code>custom-additions</code> I've tried adding each of the following:</p>
  
  <pre><code>    /// &lt;reference types="Mocha" /&gt;
  
      import 'mocha';
  
      import * as Mocha from 'mocha';
  </code></pre>
  
  <p>With no resolution to the first error.</p>
  
  <p>Within the calling code I've tried importing Mocha both via</p>
  
  <pre><code>    import Mocha = require('mocha');
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    import * as Mocha from 'mocha';
  </code></pre>
  
  <p>I've also added</p>
  
  <pre><code>    import 'custom-additions';
  </code></pre>
  
  <p>With no success.</p>
  
  <p>I'd appreciate pointers on what I'm doing wrong in trying to merge these namespaces. This is just one example--I have almost identical issues with a dozen or so other type definitions. Most of the custom additions involve actual customizations, others are type fixes as above.</p>