mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #24285 from DomiR/master
types/got: timeout can also be object, not just number
This commit is contained in:
@@ -52,6 +52,20 @@ got('todomvc.com', {
|
||||
encoding: 'utf8',
|
||||
hostname: 'todomvc'
|
||||
}).then(response => str = response.body);
|
||||
got('todomvc.com', {
|
||||
form: true,
|
||||
body: [{}],
|
||||
encoding: 'utf8',
|
||||
hostname: 'todomvc',
|
||||
timeout: 2000
|
||||
}).then(response => str = response.body);
|
||||
got('todomvc.com', {
|
||||
form: true,
|
||||
body: [{}],
|
||||
encoding: 'utf8',
|
||||
hostname: 'todomvc',
|
||||
timeout: {connect: 20, request: 20, socket: 20}
|
||||
}).then(response => str = response.body);
|
||||
// following must lead to type checking error: got('todomvc.com', {form: true, body: ''}).then(response => str = response.body);
|
||||
|
||||
got('todomvc.com', {encoding: null, hostname: 'todomvc'}).then(response => buf = response.body);
|
||||
|
||||
Vendored
+6
-2
@@ -98,7 +98,11 @@ declare namespace got {
|
||||
json?: boolean;
|
||||
}
|
||||
|
||||
type GotOptions<E extends string | null> = http.RequestOptions & {
|
||||
interface TimoutRequestOptions extends http.RequestOptions {
|
||||
timeout?: any;
|
||||
}
|
||||
|
||||
interface GotOptions<E extends string | null> extends TimoutRequestOptions {
|
||||
encoding?: E;
|
||||
query?: string | object;
|
||||
timeout?: number | TimeoutOptions;
|
||||
@@ -106,7 +110,7 @@ declare namespace got {
|
||||
followRedirect?: boolean;
|
||||
decompress?: boolean;
|
||||
useElectronNet?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface TimeoutOptions {
|
||||
connect?: number;
|
||||
|
||||
Reference in New Issue
Block a user