title: How to augment TypeScript interface in d.ts
body: <p>My use case: request's <a href="https://github.com/DefinitelyTyped/DefinitelyTyped/blob/fde627d9e806c47b10595a5abb82fb0b2a1b14d7/request/index.d.ts#L144" rel="noreferrer">RequestResponse type definition</a> is missing the <code>body</code> property and looks like this:</p>
  
  <pre><code>declare namespace request {
  
      // ...
  
      export interface RequestResponse extends http.IncomingMessage {
          request: Options;
      }
  
      // ...
  
  }
  declare var request: request.RequestAPI&lt;request.Request, request.CoreOptions, request.RequiredUriUrl&gt;;
  export = request;
  </code></pre>
  
  <p>I'm trying to fix it by creating a <code>request-fix.d.ts</code> file with something like this:</p>
  
  <pre><code>import * as http from 'http';
  declare namespace request {
      export interface RequestResponse extends http.IncomingMessage {
          body: any;
      }
  }
  </code></pre>
  
  <p>But it has no effect. My end goal is that in my <code>app.ts</code>, I can do this:</p>
  
  <pre><code>import * as rp from 'request-promise';
  import { RequestResponse } from 'request';
  
  let response = rp.get(url);
  
  response.statusCode; // works
  response.body; // doesn't compile
  </code></pre>
  
  <p>Of course I could just contribute to DefinitelyTyped :) But this question is about to augment the <code>RequestResponse</code> interface.</p>