diff --git a/types/got/index.d.ts b/types/got/index.d.ts index ed53f65c05..54b13d70dc 100644 --- a/types/got/index.d.ts +++ b/types/got/index.d.ts @@ -97,8 +97,12 @@ declare namespace got { type GotUrl = string | https.RequestOptions | Url | URL; + type Hook = (options: T) => any; + type Hooks = Record<'beforeRequest', Hook[]>; + interface GotBodyOptions extends GotOptions { body?: string | Buffer | nodeStream.Readable; + hooks?: Hooks>; } interface GotJSONOptions extends GotOptions { @@ -106,16 +110,16 @@ declare namespace got { body?: object; form?: boolean; json: true; + hooks?: Hooks; } interface GotFormOptions extends GotOptions { body?: {[key: string]: any}; form: true; json?: boolean; + hooks?: Hooks>; } - type Hook = (options?: https.RequestOptions) => any; - interface GotOptions extends InternalRequestOptions { baseUrl?: string; cookieJar?: CookieJar; @@ -128,7 +132,6 @@ declare namespace got { useElectronNet?: boolean; throwHttpErrors?: boolean; agent?: http.Agent | boolean | AgentOptions; - hooks?: Record<'beforeRequest', Hook[]>; cache?: Cache; }