My use case: request's RequestResponse type definition is missing the body property and looks like this:
declare namespace request {
// ...
export interface RequestResponse extends http.IncomingMessage {
request: Options;
}
// ...
}
declare var request: request.RequestAPI<request.Request, request.CoreOptions, request.RequiredUriUrl>;
export = request;
I'm trying to fix it by creating a request-fix.d.ts file with something like this:
import * as http from 'http';
declare namespace request {
export interface RequestResponse extends http.IncomingMessage {
body: any;
}
}
But it has no effect. My end goal is that in my app.ts, I can do this:
import * as rp from 'request-promise';
import { RequestResponse } from 'request';
let response = rp.get(url);
response.statusCode; // works
response.body; // doesn't compile
Of course I could just contribute to DefinitelyTyped :) But this question is about to augment the RequestResponse interface.
exportfor RequestResponse inrequest-fix.d.ts2. isrequest-fix.d.tsadded tofilesintsconfig.json?.d.tsfile is not producing any compile time errors even when I put nonsense there. In my tsconfig.json:"files": ["app.ts", "request-fix.d.ts" ]. Tried adding/// <reference ...>to my app.ts, no difference.skipLibCheckwas true. That moves me forward, at least I can see some more errors...bodyproperty is still not recognized by the compiler.RequestResponsetype declaration file with your own version?