diff --git a/types/request-promise-native/index.d.ts b/types/request-promise-native/index.d.ts index 29e0e0f72c..e4fc27a8c2 100644 --- a/types/request-promise-native/index.d.ts +++ b/types/request-promise-native/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for request-promise-native 1.0 // Project: https://github.com/request/request-promise-native // Definitions by: Gustavo Henke +// Matt R. Wilson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -8,7 +9,9 @@ import request = require('request'); import http = require('http'); declare namespace requestPromise { - interface RequestPromise extends request.Request, Promise { + interface RequestPromise extends request.Request { + then: Promise["then"]; + catch: Promise["catch"]; promise(): Promise; } diff --git a/types/request-promise-native/request-promise-native-tests.ts b/types/request-promise-native/request-promise-native-tests.ts index 469b901143..b4c66bd2d8 100644 --- a/types/request-promise-native/request-promise-native-tests.ts +++ b/types/request-promise-native/request-promise-native-tests.ts @@ -25,6 +25,7 @@ rpn('http://google.com').then(() => { }); rpn('http://google.com').then(console.dir); rpn('http://google.com').catch(console.error); rpn('http://google.com').then(console.dir, console.error); +rpn('http://google.com').promise().then(console.dir); rpn({ uri: 'http://google.com', resolveWithFullResponse: true }).then((response) => { }); rpn({ uri: 'http://google.com', simple: false }).catch((reason) => { }); diff --git a/types/request-promise/index.d.ts b/types/request-promise/index.d.ts index 7094d478d6..8e811a415e 100644 --- a/types/request-promise/index.d.ts +++ b/types/request-promise/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for request-promise 4.1 // Project: https://github.com/request/request-promise -// Definitions by: Christopher Glantschnig , Joe Skeen , Aya Morisawa +// Definitions by: Christopher Glantschnig +// Joe Skeen +// Aya Morisawa +// Matt R. Wilson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -10,7 +13,11 @@ import errors = require('./errors'); import Promise = require('bluebird'); declare namespace requestPromise { - interface RequestPromise extends request.Request, Promise { + interface RequestPromise extends request.Request { + then: Promise["then"]; + catch: Promise["catch"]; + finally: Promise["finally"]; + cancel: Promise["cancel"]; promise(): Promise; } diff --git a/types/request-promise/request-promise-tests.ts b/types/request-promise/request-promise-tests.ts index e23a94dd2a..421e4ef766 100644 --- a/types/request-promise/request-promise-tests.ts +++ b/types/request-promise/request-promise-tests.ts @@ -23,6 +23,8 @@ rp('http://google.com').finally(() => {}); rp('http://google.com').then(console.dir); rp('http://google.com').catch(console.error); rp('http://google.com').then(console.dir, console.error); +rp('http://google.com').cancel(); +rp('http://google.com').promise().then(console.dir); // This works as well since additional methods are only used AFTER the FIRST call in the chain: