mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Merge pull request #30790 from sigorilla/patch-got
@types/got: add TimeoutError interface
This commit is contained in:
commit
2bc9203ec0
@ -269,3 +269,4 @@ got('http://todomvc.com', { retry: 2 });
|
||||
got('http://todomvc.com', { retry: { retries: 2, methods: ['GET'], statusCodes: [408, 504], maxRetryAfter: 1 } });
|
||||
got('http://todomvc.com', { throwHttpErrors: false });
|
||||
got('http://todomvc.com', { hooks: { beforeRequest: [ () => 'foo']} });
|
||||
got('http://todomvc.com', { timeout: 1 }).catch((e) => e instanceof got.TimeoutError);
|
||||
|
||||
7
types/got/index.d.ts
vendored
7
types/got/index.d.ts
vendored
@ -53,6 +53,10 @@ declare class CancelError extends StdError {
|
||||
name: 'CancelError';
|
||||
}
|
||||
|
||||
declare class TimeoutError extends StdError {
|
||||
name: 'TimeoutError';
|
||||
}
|
||||
|
||||
declare class StdError extends Error {
|
||||
code?: string;
|
||||
host?: string;
|
||||
@ -75,6 +79,7 @@ declare const got: got.GotFn &
|
||||
MaxRedirectsError: typeof MaxRedirectsError;
|
||||
UnsupportedProtocolError: typeof UnsupportedProtocolError;
|
||||
CancelError: typeof CancelError;
|
||||
TimeoutError: typeof TimeoutError;
|
||||
};
|
||||
|
||||
interface InternalRequestOptions extends https.RequestOptions {
|
||||
@ -215,7 +220,7 @@ declare namespace got {
|
||||
removeListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
}
|
||||
|
||||
type GotError = RequestError | ReadError | ParseError | HTTPError | MaxRedirectsError | UnsupportedProtocolError | CancelError;
|
||||
type GotError = RequestError | ReadError | ParseError | HTTPError | MaxRedirectsError | UnsupportedProtocolError | CancelError | TimeoutError;
|
||||
|
||||
interface Progress {
|
||||
percent: number;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user