title: Typescript confusion: How to extend Express `Request` with custom and DefinitelyTyped lib?
body: <p>How to extend and use an extended <code>Request</code> type in Typescript / Express?</p>
  <p>I'm adding a BUNCH of middleware libraries that <code>extend</code> the <code>Request</code> Object.
  I.E. One added <code>user</code> to req. Another add <code>cookie()</code> to req. Another add <code>csrfToken()</code> to req. etc..</p>
  <p>When I add a request handler function, how do I tell that function to use the <code>req</code> with all the bells and whistles added by middleware?</p>
  <p>Do I hunt down every <code>DefinitelyTyped</code> package corresponding to the middleware? If so, then will the <code>Request</code> type be magically 'decorated` with these properties?</p>
  <p>To make it even harder, I've written my own middleware that adds properties to <code>Request</code></p>
  <p><code>req.myCustomFunction()</code></p>
  <p>In this case, will I need to declare, and extend the <code>Request</code> myself with myCustomFunction?</p>
  <p>In addition, will that <code>Request</code> which I am extending 'include' the types given by <code>DefinitelyTyped</code>?</p>
  <pre><code>declare namespace Express {
    export interface Request {
      myCustomFunction: () =&gt; void
    }
  }
  </code></pre>
  <p>Will this now include ALL the properties included via <code>DefinitelyTyped</code> AND my <code>myCustomFunction</code>?</p>
  <p>How do I reference this interface when using?</p>
  <p>Will it be <code>Express.Request</code>? Or just <code>Request</code>?</p>
  <p>If I reference it as <code>Request</code>, how does Typescript know to use &quot;my&quot; Request and not the one exported by Express's <code>DefinitelyTyped</code> library?</p>