Fix #7979, request.d.ts : Options union types

This commit is contained in:
Leo Liang
2016-02-06 11:07:09 +08:00
parent f7164a47ff
commit 90c7b5653c
2 changed files with 13 additions and 1 deletions
+9
View File
@@ -110,6 +110,15 @@ var options: request.Options = {
strictSSL: bool
};
// Below line has compile error, use OptionsWithUri or OptionsWithUrl instead. See #7979.
// options.uri = str;
const opt: request.OptionsWithUri = {
baseUrl: 'http://localhost',
uri: 'bar'
};
opt.uri = str;
// --- --- --- --- --- --- --- --- --- --- --- ---
agent = req.getAgent();
+4 -1
View File
@@ -125,7 +125,10 @@ declare module 'request' {
uri?: string;
url?: string;
}
export type Options = RequiredUriUrl & CoreOptions;
export type OptionsWithUri = UriOptions & CoreOptions;
export type OptionsWithUrl = UrlOptions & CoreOptions;
export type Options = OptionsWithUri | OptionsWithUrl;
export interface RequestCallback {
(error: any, response: http.IncomingMessage, body: any): void;