title: How do I use namespaces with TypeScript external modules?
body: <p>I have some code:</p>
  
  <p><strong>baseTypes.ts</strong></p>
  
  <pre><code>export namespace Living.Things {
    export class Animal {
      move() { /* ... */ }
    }
    export class Plant {
      photosynthesize() { /* ... */ }
    }
  }
  </code></pre>
  
  <p><strong>dog.ts</strong></p>
  
  <pre><code>import b = require('./baseTypes');
  
  export namespace Living.Things {
    // Error, can't find name 'Animal', ??
    export class Dog extends Animal {
      woof() { }
    }
  }
  </code></pre>
  
  <p><strong>tree.ts</strong></p>
  
  <pre><code>// Error, can't use the same name twice, ??
  import b = require('./baseTypes');
  import b = require('./dogs');
  
  namespace Living.Things {
    // Why do I have to write b.Living.Things.Plant instead of b.Plant??
    class Tree extends b.Living.Things.Plant {
  
    }
  }
  </code></pre>
  
  <p>This is all very confusing. I want to have a bunch of external modules all contribute types to the same namespace, <code>Living.Things</code>. It seems that this doesn't work at all -- I can't see <code>Animal</code> in <code>dogs.ts</code>. I have to write the full namespace name <code>b.Living.Things.Plant</code> in <code>tree.ts</code>. It doesn't work to combine multiple objects in the same namespace across file. How do I do this?</p>