title: howto make typescript class instance available using type definition
body: <p>Example of a typescript definition file using <a href="http://www.typescriptlang.org/Handbook#writing-dts-files" rel="nofollow">the decomposed class pattern</a>:</p>
  
  <pre><code>declare module io {
    interface IOStatic {
      new(name: string): IOInstance;
      name: string;
    }
  
    interface IOInstance {
      get(): string
    }
  }
  declare var IO: io.IOStatic;
  declare module "IO" {
    export = IO;
  }
  </code></pre>
  
  <p>It is used in:</p>
  
  <pre><code>/// &lt;reference path='external.d.ts' /&gt;
  import IO = require('IO');
  
  var x = new IO('John');
  </code></pre>
  
  <p>which works fine.</p>
  
  <p>Question: how can I used the type definition of the IO instance in a type check, e.g.:</p>
  
  <pre><code>getName(io: IO): string {
    return io.get();
  }
  </code></pre>
  
  <p>error TS4022: Type reference cannot refer to container 'IO'.
  Should I export the instance definition too? If yes, how?</p>