Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(solid-query): replace Accessor<T> wth FunctionedParams<T> #8535

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/solid-query/src/infiniteQueryOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import type {
InfiniteData,
QueryKey,
} from '@tanstack/query-core'
import type { FunctionedParams, SolidInfiniteQueryOptions } from './types'
import type { SolidInfiniteQueryOptions } from './types'
import type { Accessor } from 'solid-js'

export type UndefinedInitialDataInfiniteOptions<
TQueryFnData,
TError = DefaultError,
TData = InfiniteData<TQueryFnData>,
TQueryKey extends QueryKey = QueryKey,
TPageParam = unknown,
> = FunctionedParams<
> = Accessor<
SolidInfiniteQueryOptions<
TQueryFnData,
TError,
Expand All @@ -34,7 +35,7 @@ export type DefinedInitialDataInfiniteOptions<
TData = InfiniteData<TQueryFnData>,
TQueryKey extends QueryKey = QueryKey,
TPageParam = unknown,
> = FunctionedParams<
> = Accessor<
SolidInfiniteQueryOptions<
TQueryFnData,
TError,
Expand Down
7 changes: 4 additions & 3 deletions packages/solid-query/src/queryOptions.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import type { DataTag, DefaultError, QueryKey } from '@tanstack/query-core'
import type { FunctionedParams, SolidQueryOptions } from './types'
import type { SolidQueryOptions } from './types'
import type { Accessor } from 'solid-js'

export type UndefinedInitialDataOptions<
TQueryFnData = unknown,
TError = DefaultError,
TData = TQueryFnData,
TQueryKey extends QueryKey = QueryKey,
> = FunctionedParams<
> = Accessor<
SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
initialData?: undefined
}
Expand All @@ -17,7 +18,7 @@ export type DefinedInitialDataOptions<
TError = DefaultError,
TData = TQueryFnData,
TQueryKey extends QueryKey = QueryKey,
> = FunctionedParams<
> = Accessor<
SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
initialData: TQueryFnData | (() => TQueryFnData)
}
Expand Down
9 changes: 4 additions & 5 deletions packages/solid-query/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import type {
InfiniteQueryObserverOptions,
QueryObserverOptions,
} from './QueryClient'

export type FunctionedParams<T> = () => T
import type { Accessor } from 'solid-js'

export interface CreateBaseQueryOptions<
TQueryFnData = unknown,
Expand Down Expand Up @@ -63,7 +62,7 @@ export type CreateQueryOptions<
TError = DefaultError,
TData = TQueryFnData,
TQueryKey extends QueryKey = QueryKey,
> = FunctionedParams<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey>>
> = Accessor<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey>>

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

Expand Down Expand Up @@ -128,7 +127,7 @@ export type CreateInfiniteQueryOptions<
TData = TQueryFnData,
TQueryKey extends QueryKey = QueryKey,
TPageParam = unknown,
> = FunctionedParams<
> = Accessor<
SolidInfiniteQueryOptions<
TQueryFnData,
TError,
Expand Down Expand Up @@ -165,7 +164,7 @@ export type CreateMutationOptions<
TError = DefaultError,
TVariables = void,
TContext = unknown,
> = FunctionedParams<SolidMutationOptions<TData, TError, TVariables, TContext>>
> = Accessor<SolidMutationOptions<TData, TError, TVariables, TContext>>

export type CreateMutateFunction<
TData = unknown,
Expand Down
Loading