title: TypeScript: How to use internal interface within namespace
body: <p>I have an interface that I only want to use within a namespace (internal module) and it should not be used outside the namespace.</p>
  
  <p><strong>Example interface:</strong></p>
  
  <pre><code>namespace Test {
      interface IInterface {
          getId(): number;
          getName(): string;
      }
  }
  </code></pre>
  
  <p>Unfortunately I get an error when I try to implement this interface within the same namespace if I don't export the interface (which I don't want to).</p>
  
  <p><strong>Implementing class:</strong></p>
  
  <pre><code>namespace Test {
      class Implementer implements IInterface {
          private location: Location;
  
          public getId(): number {
              return 1;
          }
  
          public getName(): string {
              return "implementer name";
          }
      }
  }
  </code></pre>
  
  <p>Which gives: <em>TS2304: Cannot find name 'IInterface'.</em> in 'Implementer.ts'.</p>
  
  <p>Notice the private member of type 'Location' which is also a new type/class defined by myself in the same namespace and that is the actual reason for using namespaces because the type 'Location' already exists in the global space.</p>
  
  <p><strong>Class with conflicting name if used outside namespace:</strong></p>
  
  <pre><code>namespace Test {
      class Location {
          private name: string = null;
          constructor(name: string) {
              this.name = name;
          }
      }
  }
  </code></pre>
  
  <p>Additionally: I'm not using any modules and I'm converting some types from JavaScript to TypeScript classes. Using the <code>/// &lt;reference path="IInterface.ts" /&gt;</code> helper doesn't work (and is not the problem here). I also don't want to introduce any module loader.</p>
  
  <p>So how do I use my interface in the same namespace without exporting it?</p>