diff --git a/types/got/index.d.ts b/types/got/index.d.ts index 43ed5a5f35..e8890429ce 100644 --- a/types/got/index.d.ts +++ b/types/got/index.d.ts @@ -69,7 +69,7 @@ declare class StdError extends Error { response?: any; } -declare const got: got.DefaultGotInstance; +declare const got: got.GotInstance; interface InternalRequestOptions extends https.RequestOptions { // Redeclare options with `any` type for allow specify types incompatible with http.RequestOptions. @@ -94,28 +94,25 @@ declare namespace got { type GotInstance = T & Record<'get' | 'post' | 'put' | 'patch' | 'head' | 'delete', T> & - { - stream: GotStreamFn & Record<'get' | 'post' | 'put' | 'patch' | 'head' | 'delete', GotStreamFn>; - extend: GotExtend; - RequestError: typeof RequestError; - ReadError: typeof ReadError; - ParseError: typeof ParseError; - HTTPError: typeof HTTPError; - MaxRedirectsError: typeof MaxRedirectsError; - UnsupportedProtocolError: typeof UnsupportedProtocolError; - CancelError: typeof CancelError; - TimeoutError: typeof TimeoutError; - }; - - type DefaultGotInstance = GotInstance; - type JSONGotInstance = GotInstance; + { + stream: GotStreamFn & Record<'get' | 'post' | 'put' | 'patch' | 'head' | 'delete', GotStreamFn>; + extend: GotExtend; + RequestError: typeof RequestError; + ReadError: typeof ReadError; + ParseError: typeof ParseError; + HTTPError: typeof HTTPError; + MaxRedirectsError: typeof MaxRedirectsError; + UnsupportedProtocolError: typeof UnsupportedProtocolError; + CancelError: typeof CancelError; + TimeoutError: typeof TimeoutError; + }; interface GotExtend { - (options: GotJSONOptions): JSONGotInstance; - (options: GotFormOptions): DefaultGotInstance; - (options: GotBodyOptions): DefaultGotInstance; - (options: GotFormOptions): DefaultGotInstance; - (options: GotBodyOptions): DefaultGotInstance; + (options: GotJSONOptions): GotInstance; + (options: GotFormOptions): GotInstance; + (options: GotBodyOptions): GotInstance; + (options: GotFormOptions): GotInstance; + (options: GotBodyOptions): GotInstance; } type GotStreamFn = (url: GotUrl, options?: GotOptions) => GotEmitter & nodeStream.Duplex;