title: TypeScript, Node.js, require and module in Visual Studio 2013
body: <p>Is it incorrect to use this code in a <em>TypeScript</em> file in Visual Studio 2013 for a <em>Node.js</em> code base?</p>
  
  <pre><code>// toolset_1.ts, this file is referenced in other .ts files
  declare function require(name: string);
  declare var module;
  
  declare var __dirname;
  </code></pre>
  
  <p><strong>Setup:</strong> </p>
  
  <ul>
  <li>Project is created using <code>node</code> in a directory.</li>
  <li>A <em>TypeScript</em> project created in the same directory, using VS 2013.</li>
  </ul>
  
  <p><strong>Current Situation/Configuration:</strong></p>
  
  <ul>
  <li><p>Me: C# developer, Node.js and TypeScript noob.</p></li>
  <li><p>TypeScript: Module system option is set to None.</p></li>
  <li><p>Project Description: A simple play ground with Node.js, Express.js
  and bunch of other tools with some TypeScript code.</p></li>
  <li><p>Project Status: It works (Simple GET(Hogan.js), POST, PUT and DELETE
  request are being servered)</p></li>
  </ul>
  
  <p>For example this is <em>pile.ts</em> in <em>routes</em> directory (express):</p>
  
  <pre><code>/// &lt;reference path="./lib/toolset_1.ts" /&gt;
  
  var express = require('express');
  var router = express.Router();
  
  router.get('/', function (req, res, next) {
      res.render('pile', { title: 'PILED', msg: '[PILED]' });
  });
  
  router.post('/', function (req, res) {
      res.send({ time: new Date(), msg: 'post [PILED]' });
  });
  
  router.put('/', function (req, res) {
      res.send({ time: new Date(), msg: 'put [PILED]' });
  });
  
  router.delete('/', function (req, res) {
      res.send({ time: new Date(), msg: 'delete [PILED]' });
  });
  
  module.exports = router; 
  </code></pre>