title: TypeScript require with type checking
body: <p>I am using TypeScript v1.4.1 and would like to require an external module (in this case "chai") and have it be type checked.</p>
  
  <p>However, I am running into some sort of naming conflict with this code:</p>
  
  <pre><code>/// &lt;reference path="../typings/node/node.d.ts" /&gt;
  /// &lt;reference path="../typings/chai/chai.d.ts" /&gt;
  /// &lt;reference path="../typings/mocha/mocha.d.ts" /&gt;
  
  var chai = require("chai");
  
  var expect = chai.expect;
  var assert = chai.assert;
  
  describe("TEST", () =&gt;
  {
     it("true should be true", (done)=&gt;
     {
        expect(true).to.be.true;
        done();
     });
  });
  </code></pre>
  
  <p>With this definition file:</p>
  
  <pre><code>declare module chai {
     ...
  }
  declare module "chai" {
     export = chai;
  }
  </code></pre>
  
  <p>Compiling gives these errors:</p>
  
  <pre><code>test/test.ts(5,5): error TS2300: Duplicate identifier 'chai'.
  typings/chai/chai.d.ts(6,16): error TS2300: Duplicate identifier 'chai'.
  </code></pre>
  
  <p>It seems my only option is rename my <code>chai</code> variable name in test.ts.  That seems clunky AND won't type check the use of the renamed <code>chai</code> variable.</p>
  
  <p>Any advice?</p>