Skip to content

Commit eebc9a3

Browse files
authored
refactor: replace Accessor<T> wth FunctionedParams<T> (#8535)
1 parent 64368bf commit eebc9a3

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

packages/solid-query/src/infiniteQueryOptions.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ import type {
44
InfiniteData,
55
QueryKey,
66
} from '@tanstack/query-core'
7-
import type { FunctionedParams, SolidInfiniteQueryOptions } from './types'
7+
import type { SolidInfiniteQueryOptions } from './types'
8+
import type { Accessor } from 'solid-js'
89

910
export type UndefinedInitialDataInfiniteOptions<
1011
TQueryFnData,
1112
TError = DefaultError,
1213
TData = InfiniteData<TQueryFnData>,
1314
TQueryKey extends QueryKey = QueryKey,
1415
TPageParam = unknown,
15-
> = FunctionedParams<
16+
> = Accessor<
1617
SolidInfiniteQueryOptions<
1718
TQueryFnData,
1819
TError,
@@ -34,7 +35,7 @@ export type DefinedInitialDataInfiniteOptions<
3435
TData = InfiniteData<TQueryFnData>,
3536
TQueryKey extends QueryKey = QueryKey,
3637
TPageParam = unknown,
37-
> = FunctionedParams<
38+
> = Accessor<
3839
SolidInfiniteQueryOptions<
3940
TQueryFnData,
4041
TError,

packages/solid-query/src/queryOptions.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import type { DataTag, DefaultError, QueryKey } from '@tanstack/query-core'
2-
import type { FunctionedParams, SolidQueryOptions } from './types'
2+
import type { SolidQueryOptions } from './types'
3+
import type { Accessor } from 'solid-js'
34

45
export type UndefinedInitialDataOptions<
56
TQueryFnData = unknown,
67
TError = DefaultError,
78
TData = TQueryFnData,
89
TQueryKey extends QueryKey = QueryKey,
9-
> = FunctionedParams<
10+
> = Accessor<
1011
SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
1112
initialData?: undefined
1213
}
@@ -17,7 +18,7 @@ export type DefinedInitialDataOptions<
1718
TError = DefaultError,
1819
TData = TQueryFnData,
1920
TQueryKey extends QueryKey = QueryKey,
20-
> = FunctionedParams<
21+
> = Accessor<
2122
SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
2223
initialData: TQueryFnData | (() => TQueryFnData)
2324
}

packages/solid-query/src/types.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import type {
1717
InfiniteQueryObserverOptions,
1818
QueryObserverOptions,
1919
} from './QueryClient'
20-
21-
export type FunctionedParams<T> = () => T
20+
import type { Accessor } from 'solid-js'
2221

2322
export interface CreateBaseQueryOptions<
2423
TQueryFnData = unknown,
@@ -63,7 +62,7 @@ export type CreateQueryOptions<
6362
TError = DefaultError,
6463
TData = TQueryFnData,
6564
TQueryKey extends QueryKey = QueryKey,
66-
> = FunctionedParams<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey>>
65+
> = Accessor<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey>>
6766

6867
/* --- Create Query and Create Base Query Types --- */
6968

@@ -128,7 +127,7 @@ export type CreateInfiniteQueryOptions<
128127
TData = TQueryFnData,
129128
TQueryKey extends QueryKey = QueryKey,
130129
TPageParam = unknown,
131-
> = FunctionedParams<
130+
> = Accessor<
132131
SolidInfiniteQueryOptions<
133132
TQueryFnData,
134133
TError,
@@ -165,7 +164,7 @@ export type CreateMutationOptions<
165164
TError = DefaultError,
166165
TVariables = void,
167166
TContext = unknown,
168-
> = FunctionedParams<SolidMutationOptions<TData, TError, TVariables, TContext>>
167+
> = Accessor<SolidMutationOptions<TData, TError, TVariables, TContext>>
169168

170169
export type CreateMutateFunction<
171170
TData = unknown,

0 commit comments

Comments
 (0)