fetch-extras
Advanced tools
+1
-1
| { | ||
| "name": "fetch-extras", | ||
| "version": "3.2.0", | ||
| "version": "3.2.1", | ||
| "description": "Useful utilities for working with Fetch", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -83,2 +83,4 @@ /** | ||
| */ | ||
| export function withHttpError(): (fetchFunction: typeof fetch) => typeof fetch; | ||
| export function withHttpError(): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -71,2 +71,4 @@ /** | ||
| baseUrl: URL | string | ||
| ): (fetchFunction: typeof fetch) => typeof fetch; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -55,2 +55,4 @@ /** | ||
| }, | ||
| ): (fetchFunction: typeof fetch) => typeof fetch; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -51,2 +51,4 @@ /** | ||
| }, | ||
| ): (fetchFunction: typeof fetch) => typeof fetch; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -45,2 +45,4 @@ /** | ||
| */ | ||
| export function withDeduplication(): (fetchFunction: typeof fetch) => typeof fetch; | ||
| export function withDeduplication(): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -47,2 +47,4 @@ /** | ||
| } | ||
| ): (fetchFunction: typeof fetch) => typeof fetch; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -59,2 +59,4 @@ /** | ||
| defaultHeaders: HeadersInit | (() => HeadersInit | Promise<HeadersInit>) | ||
| ): (fetchFunction: typeof fetch) => typeof fetch; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -91,2 +91,4 @@ /** | ||
| }, | ||
| ): (fetchFunction: typeof fetch) => typeof fetch; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -51,4 +51,5 @@ /** | ||
| */ | ||
| // This wrapper intentionally defines the widened request tuple instead of preserving `Parameters<FetchFunction>`. Later transparent wrappers preserve this returned tuple. | ||
| export function withJsonBody(): ( | ||
| fetchFunction: typeof fetch | ||
| ) => (input: RequestInfo | URL, init?: JsonBodyRequestInit) => Promise<Response>; |
@@ -129,5 +129,5 @@ // Standard Schema types (inlined from https://standardschema.dev) | ||
| */ | ||
| export function withJsonResponse(): ( | ||
| fetchFunction: typeof fetch, | ||
| ) => (...arguments_: Parameters<typeof fetch>) => Promise<unknown>; | ||
| export function withJsonResponse(): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<unknown>; | ||
@@ -206,4 +206,4 @@ /** | ||
| }, | ||
| ): ( | ||
| fetchFunction: typeof fetch, | ||
| ) => (...arguments_: Parameters<typeof fetch>) => Promise<Schema extends StandardSchemaV1 ? StandardSchemaV1InferOutput<Schema> : unknown>; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Schema extends StandardSchemaV1 ? StandardSchemaV1InferOutput<Schema> : unknown>; |
@@ -53,2 +53,4 @@ /** | ||
| }, | ||
| ): (fetchFunction: typeof fetch) => typeof fetch; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -43,4 +43,4 @@ export type ResponseTransform<Value> = (response: Response) => Value | Promise<Value>; | ||
| transform: ResponseTransform<Value>, | ||
| ): ( | ||
| fetchFunction: typeof fetch, | ||
| ) => (...arguments_: Parameters<typeof fetch>) => Promise<Awaited<Value>>; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Awaited<Value>>; |
@@ -137,2 +137,4 @@ /** | ||
| }, | ||
| ): (fetchFunction: typeof fetch) => typeof fetch; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -45,2 +45,4 @@ /** | ||
| defaultSearchParameters: Record<string, string> | URLSearchParams | ReadonlyArray<readonly [string, string]> | ||
| ): (fetchFunction: typeof fetch) => typeof fetch; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -33,2 +33,4 @@ /** | ||
| timeout: number | ||
| ): (fetchFunction: typeof fetch) => typeof fetch; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -72,2 +72,4 @@ /** | ||
| } | ||
| ): (fetchFunction: typeof fetch) => typeof fetch; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
@@ -34,2 +34,4 @@ import type {Progress} from './with-download-progress.js'; | ||
| } | ||
| ): (fetchFunction: typeof fetch) => typeof fetch; | ||
| ): <FetchFunction extends typeof fetch>( | ||
| fetchFunction: FetchFunction | ||
| ) => (...arguments_: Parameters<FetchFunction>) => Promise<Response>; |
167687
0.94%3818
0.77%19
-47.22%