hook-fetch 2.2.3 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # hook-fetch
2
2
 
3
+ ## 2.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Improve type safety for streaming API:
8
+ - Add generic parameter support to `stream<U = T>()` method, allowing type override at stream stage
9
+ - Improve TypeScript inference: recommend specifying response type at request method level (e.g., `post<T>()`) rather than stream level for better type safety
10
+ - Update internal type handling in stream implementation for more accurate type narrowing
11
+
3
12
  ## 2.2.3
4
13
 
5
14
  ### Patch Changes
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "hook-fetch-plugin-response-transform",
19
19
  "hook-fetch-plugin-request-transform"
20
20
  ],
21
- "version": "2.2.3",
21
+ "version": "2.2.4",
22
22
  "scripts": {
23
23
  "dev": "vite",
24
24
  "build:rolldown": "rolldown -c ./rolldown.config.ts",
@@ -18,7 +18,7 @@ declare class HookFetchRequest<T = unknown, E = unknown> implements PromiseLike<
18
18
  formData(): Promise<FormData>;
19
19
  bytes(): Promise<Uint8Array<ArrayBufferLike>>;
20
20
  __injectPlugins__(plugins: HookFetchPlugin<any, any, any, any>[]): void;
21
- stream<T>(): AsyncGenerator<StreamContext<T> | StreamContext<null>, ResponseError<unknown> | undefined, unknown>;
21
+ stream<U = T>(): AsyncGenerator<StreamContext<U> | StreamContext<null>, ResponseError<unknown> | undefined, unknown>;
22
22
  retry(): HookFetchRequest<unknown, E>;
23
23
  get response(): Promise<Response>;
24
24
  }
package/types/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { AfterResponseHandler, BaseOptions, BaseRequestOptions, BeforeRequestHandler, BeforeStreamHandler, DeleteOptions, FetchPluginContext, FetchResponseType, GetOptions, HeadOptions, HookFetchPlugin, OnErrorHandler, OnFinallyHandler, OptionProps, OptionsOptions, PatchOptions, PostOptions, PutOptions, RequestConfig, RequestMethod, RequestMethodWithBody, RequestMethodWithParams, RequestOptions, RequestUseOptions, RequestWithBodyFnOptions, RequestWithBodyOptions, RequestWithParamsFnOptions, RequestWithParamsOptions, ResponseError, ResponseErrorOptions, StreamContext, TransformStreamChunkHandler } from "./types-DBxr9vw6.js";
2
- import { ContentType, HookFetchRequest, Method, StatusCode, del, get, head, hookFetch, options, patch, post, put, request, upload } from "./index-D-UG4s58.js";
2
+ import { ContentType, HookFetchRequest, Method, StatusCode, del, get, head, hookFetch, options, patch, post, put, request, upload } from "./index-B8RQnqnd.js";
3
3
  export { AfterResponseHandler, BaseOptions, BaseRequestOptions, BeforeRequestHandler, BeforeStreamHandler, ContentType, DeleteOptions, FetchPluginContext, FetchResponseType, GetOptions, HeadOptions, HookFetchPlugin, HookFetchRequest, Method, OnErrorHandler, OnFinallyHandler, OptionProps, OptionsOptions, PatchOptions, PostOptions, PutOptions, RequestConfig, RequestMethod, RequestMethodWithBody, RequestMethodWithParams, RequestOptions, RequestUseOptions, RequestWithBodyFnOptions, RequestWithBodyOptions, RequestWithParamsFnOptions, RequestWithParamsOptions, ResponseError, ResponseErrorOptions, StatusCode, StreamContext, TransformStreamChunkHandler, hookFetch as default, del, get, head, options, patch, post, put, request, upload };
@@ -1,5 +1,5 @@
1
1
  import { ResponseError, StreamContext } from "../types-DBxr9vw6.js";
2
- import { HookFetchRequest$1 as HookFetchRequest } from "../index-D-UG4s58.js";
2
+ import { HookFetchRequest$1 as HookFetchRequest } from "../index-B8RQnqnd.js";
3
3
  import * as react0 from "react";
4
4
 
5
5
  //#region src/react/index.d.ts
@@ -1,5 +1,5 @@
1
1
  import { ResponseError, StreamContext } from "../types-DBxr9vw6.js";
2
- import { HookFetchRequest$1 as HookFetchRequest } from "../index-D-UG4s58.js";
2
+ import { HookFetchRequest$1 as HookFetchRequest } from "../index-B8RQnqnd.js";
3
3
  import * as vue0 from "vue";
4
4
 
5
5
  //#region src/vue/index.d.ts