diff --git a/types/got/got-tests.ts b/types/got/got-tests.ts index 8aae7f300d..d3c0db19aa 100644 --- a/types/got/got-tests.ts +++ b/types/got/got-tests.ts @@ -269,6 +269,8 @@ got.extend({ method: 'POST' }).extend({ headers: {} }).stream('/example'); // $ExpectType Promise got.extend({ json: true })('/example').then(({ body }) => body); // $ExpectType Promise +got.extend({ json: true })('/example', { query: {} }).then(({ body }) => body); +// $ExpectType Promise got.extend({ baseUrl: 'https://localhost' }).extend({ json: true })('/example').then(({ body }) => body); // $ExpectType Promise got.extend({})('/example').then(({ body }) => body); @@ -276,20 +278,28 @@ got.extend({})('/example').then(({ body }) => body); // $ExpectType Promise got.extend({ form: true, encoding: null })('/example').then(({ body }) => body); // $ExpectType Promise +got.extend({ form: true, encoding: null })('/example', { query: {} }).then(({ body }) => body); +// $ExpectType Promise got.extend({ form: true, encoding: null, body: {} })('/example').then(({ body }) => body); // $ExpectType Promise got.extend({ form: true, encoding: 'utf8' })('/example').then(({ body }) => body); // $ExpectType Promise +got.extend({ form: true, encoding: 'utf8' })('/example', { query: {} }).then(({ body }) => body); +// $ExpectType Promise got.extend({ form: true, encoding: 'utf8', body: {} })('/example').then(({ body }) => body); // Body options: // $ExpectType Promise got.extend({ encoding: null })('/example').then(({ body }) => body); // $ExpectType Promise got.extend({ encoding: null, body: '{}' })('/example').then(({ body }) => body); +// $ExpectType Promise +got.extend({ encoding: null, body: '{}' })('/example', { query: {} }).then(({ body }) => body); // $ExpectType Promise got.extend({ encoding: 'utf8' })('/example').then(({ body }) => body); // $ExpectType Promise got.extend({ encoding: 'utf8', body: '{}' })('/example').then(({ body }) => body); +// $ExpectType Promise +got.extend({ encoding: 'utf8', body: '{}' })('/example', { query: {} }).then(({ body }) => body); // Test retry options. got('http://todomvc.com', { retry: 2 }); diff --git a/types/got/index.d.ts b/types/got/index.d.ts index 8fb6a71e63..6d070fcadd 100644 --- a/types/got/index.d.ts +++ b/types/got/index.d.ts @@ -90,12 +90,12 @@ declare namespace got { interface GotJSONFn { (url: GotUrl): GotPromise; - (url: GotUrl, options: GotJSONOptions): GotPromise; + (url: GotUrl, options: Partial): GotPromise; } interface GotFormFn { (url: GotUrl): GotPromise; - (url: GotUrl, options: GotFormOptions): GotPromise; + (url: GotUrl, options: Partial>): GotPromise; } interface GotBodyFn {