title: Require node.js module in an internal typescript module
body: <p>I want to port a a multi-file node.js project to a multiple file Typescript project compiling to a single <code>.js</code> by using Typescript internal modules. How I can <code>require</code> a node.js module from an internal Typescript module? Here is a sample application:</p>
  
  <p>a.js:</p>
  
  <pre><code>var os = require('os')
  exports.foo = os.hostname()
  </code></pre>
  
  <p>b.js:</p>
  
  <pre><code>var os = require('os')
  exports.foo = os.hostname()
  </code></pre>
  
  <p>How do I port the code to Typescript?</p>
  
  <p>I have no problems until I want to require:</p>
  
  <p>a.ts:</p>
  
  <pre><code>/// &lt;reference path="b.ts" /&gt;
  console.log(b.foo)
  </code></pre>
  
  <p>b.ts:</p>
  
  <pre><code>module b {
      export var foo = 42;
  }
  </code></pre>
  
  <p>How do I change the code so <code>foo = os.hostname()</code> works?</p>