title: Extending Express Request object using TypeScript
body: <p>I'm trying to get the hang of TypeScript and various guides on how to use node.js and express talk about adding properties to the Request object before passing them down through the middleware.</p>
  
  <p>Of course, for type script these properties have to be defined so I tried to do so in a file called local.d.ts:</p>
  
  <pre><code>/// &lt;reference path="tsd.d.ts" /&gt;
  import mySql = require('mysql');
  declare module Express {
      export interface Request {
          dbPool: mySql.IPool;
      }
  }
  </code></pre>
  
  <p>I then try to call it from my main code file:</p>
  
  <pre><code>/// &lt;reference path="typings/tsd.d.ts" /&gt;
  /// &lt;reference path="typings/local.d.ts" /&gt;
  ...
  import express = require('express');
  ...
  var pool = mySql.createPool({
      user: "username",
      ...
  });
  app.use(function (req, res, next) {
      req.dbPool = pool;
  });
  </code></pre>
  
  <p>But I get: "Property 'dbPool' does not exist on type 'Request'."
  What am I doing wrong?</p>