mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #7991 from aleung/request
Fix #7979, request.d.ts : Options union types
This commit is contained in:
@@ -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();
|
||||
|
||||
Vendored
+4
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user