diff --git a/src/index.d.ts b/src/index.d.ts index 0c53ad9..7f2c7a6 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -12,6 +12,33 @@ declare namespace unfetch { export type IsomorphicRequest = Request | NodeRequest } -declare const unfetch: typeof fetch; +type UnfetchResponse = { + ok: boolean, + statusText: string, + status: number, + url: string, + text: () => Promise, + json: () => Promise, + blob: () => Promise, + clone: () => UnfetchResponse, + headers: { + keys: () => string[], + entries: () => Array<[string, string]>, + get: (key: string) => string | undefined, + has: (key: string) => boolean, + } +} + +type Unfetch = ( + url: string, + options?: { + method?: string, + headers?: Record, + credentials?: 'include' | 'omit', + body?: Parameters[0] + } +) => Promise + +declare const unfetch: Unfetch; export default unfetch;