From 8ce973cf20e75809ca8481e7a52af58ca961d16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Mon, 21 Aug 2017 18:14:40 +0200 Subject: [PATCH] [got] Fix return type of json request --- types/got/got-tests.ts | 1 + types/got/index.d.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/got/got-tests.ts b/types/got/got-tests.ts index 29370358be..a051bf46bd 100644 --- a/types/got/got-tests.ts +++ b/types/got/got-tests.ts @@ -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); diff --git a/types/got/index.d.ts b/types/got/index.d.ts index c96c7eff25..5f45202937 100644 --- a/types/got/index.d.ts +++ b/types/got/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for got 7.1 // Project: https://github.com/sindresorhus/got#readme // Definitions by: BendingBender +// Linus Unnebäck // 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; - (url: GotUrl, options: GotJSONOptions): GotPromise; + (url: GotUrl, options: GotJSONOptions): GotPromise; (url: GotUrl, options: GotFormOptions): GotPromise; (url: GotUrl, options: GotFormOptions): GotPromise; (url: GotUrl, options: GotBodyOptions): GotPromise;