[got] Fix return type of json request

This commit is contained in:
Linus Unnebäck
2017-08-21 18:14:40 +02:00
parent 491b48e136
commit 8ce973cf20
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -19,6 +19,7 @@ got('todomvc.com')
got('todomvc.com').cancel();
got('todomvc.com', {json: true}).then(response => obj = response.body);
got('todomvc.com', {json: true}).then(response => str = response.body);
got('todomvc.com', {json: true, body: {}}).then(response => obj = response.body);
got('todomvc.com', {json: true, body: [{}]}).then(response => obj = response.body);
got('todomvc.com', {json: true, form: true}).then(response => obj = response.body);
+2 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for got 7.1
// Project: https://github.com/sindresorhus/got#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Linus Unnebäck <https://github.com/LinusU>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -21,7 +22,7 @@ declare namespace got {
// tslint:disable unified-signatures
interface GotFn {
(url: GotUrl): GotPromise<string>;
(url: GotUrl, options: GotJSONOptions): GotPromise<object>;
(url: GotUrl, options: GotJSONOptions): GotPromise<any>;
(url: GotUrl, options: GotFormOptions<string>): GotPromise<string>;
(url: GotUrl, options: GotFormOptions<null>): GotPromise<Buffer>;
(url: GotUrl, options: GotBodyOptions<string>): GotPromise<string>;