diff --git a/types/bent/index.d.ts b/types/bent/index.d.ts index 6730590d8c..61943b623b 100644 --- a/types/bent/index.d.ts +++ b/types/bent/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for bent 7.0 // Project: https://github.com/mikeal/bent#readme -// Definitions by: Ovyerus +// Definitions by: Ovyerus // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.7 @@ -11,7 +11,9 @@ import { PassThrough, Stream } from 'stream'; type HttpMethod = 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE'; type StatusCode = number; type BaseUrl = string; -interface Headers { [key: string]: any; } +interface Headers { + [key: string]: any; +} // Type first declare function bent(type: 'string', ...args: bent.Options[]): bent.RequestFunction; @@ -20,7 +22,11 @@ declare function bent(type: 'json', ...args: bent.Options[]): bent.RequestFuncti // Method or url first declare function bent(baseUrl: string, type: 'string', ...args: bent.Options[]): bent.RequestFunction; -declare function bent(baseUrl: string, type: 'buffer', ...args: bent.Options[]): bent.RequestFunction; +declare function bent( + baseUrl: string, + type: 'buffer', + ...args: bent.Options[] +): bent.RequestFunction; declare function bent(baseUrl: string, type: 'json', ...args: bent.Options[]): bent.RequestFunction; declare function bent(baseUrl: string, ...args: bent.Options[]): bent.RequestFunction; @@ -33,18 +39,18 @@ declare function bent(...args: bent.Options[]): bent.RequestFunction; declare namespace bent { - type RequestFunction = (url: string, body?: RequestBody) => Promise; + type RequestFunction = (url: string, body?: RequestBody, headers?: Headers) => Promise; type Options = HttpMethod | StatusCode | Headers | BaseUrl; type RequestBody = string | Stream | Buffer | ArrayBuffer | Json; type NodeResponse = PassThrough & { statusCode: number; statusMessage: string; - headers: Headers + headers: Headers; }; - type FetchResponse = Response & {statusCode: number}; + type FetchResponse = Response & { statusCode: number }; type BentResponse = NodeResponse | FetchResponse; - type Json = { [key: string]: any; [key: number]: any; } | any[]; + type Json = { [key: string]: any; [key: number]: any } | any[]; type ValidResponse = BentResponse | string | Buffer | ArrayBuffer | Json; }