soda-tanstack-query 0.0.4 → 0.0.6

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.
@@ -1,7 +1,5 @@
1
1
  import { DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, UndefinedInitialDataOptions, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
2
- import { StrictPartial } from "soda-type";
3
- /** 判断函数的参数是否为必需的 */
4
- export type IsParamRequired<TFn extends (params: any) => any> = Parameters<TFn> extends [param: any] ? true : false;
2
+ import { IsParamRequired, StrictPartial } from "soda-type";
5
3
  /** 参数必须的 useQuery */
6
4
  interface _UseQueryWithParams<TFn extends (params: any) => any, TInitSelectData = Awaited<ReturnType<TFn>>, TParams = Parameters<TFn>[0], TResponse = Awaited<ReturnType<TFn>>> {
7
5
  <TData = TInitSelectData>(params: TParams): UseQueryResult<NoInfer<TData>, Error>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soda-tanstack-query",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -7,12 +7,9 @@ import {
7
7
  UseQueryOptions,
8
8
  UseQueryResult,
9
9
  } from "@tanstack/react-query"
10
- import { StrictPartial } from "soda-type"
10
+ import { IsParamRequired, StrictPartial } from "soda-type"
11
11
 
12
- /** 判断函数的参数是否为必需的 */
13
- export type IsParamRequired<TFn extends (params: any) => any> = Parameters<TFn> extends [param: any] ? true : false
14
-
15
- // 要在第一个加一个重载,因为 options 是可选的,如果不加这个重载,类型会任务是 DefinedInitialDataOptions,造成返回类型必定不为 undefined
12
+ // 要在第一个加一个重载,因为 options 是可选的,如果不加这个重载,options 类型会匹配到 DefinedInitialDataOptions,会误认为 initialData 被传递了,造成返回类型必定不为 undefined
16
13
 
17
14
  /** 参数必须的 useQuery */
18
15
  interface _UseQueryWithParams<