import { DataTag, DefaultError, InitialDataFunction, NonUndefinedGuard, OmitKeyof, QueryFunction, QueryKey, SkipToken } from '@tanstack/query-core'; import { CreateQueryOptions } from './types.js'; export type UndefinedInitialDataOptions = CreateQueryOptions & { initialData?: undefined | InitialDataFunction> | NonUndefinedGuard; }; export type UnusedSkipTokenOptions = OmitKeyof, 'queryFn'> & { queryFn?: Exclude['queryFn'], SkipToken | undefined>; }; export type DefinedInitialDataOptions = Omit, 'queryFn'> & { initialData: NonUndefinedGuard | (() => NonUndefinedGuard); queryFn?: QueryFunction; }; /** * Allows to share and re-use query options in a type-safe way. * * The `queryKey` will be tagged with the type from `queryFn`. * * **Example** * * ```ts * const { queryKey } = queryOptions({ * queryKey: ['key'], * queryFn: () => Promise.resolve(5), * // ^? Promise * }) * * const queryClient = new QueryClient() * const data = queryClient.getQueryData(queryKey) * // ^? number | undefined * ``` * @param options - The query options to tag with the type from `queryFn`. * @returns The tagged query options. */ export declare function queryOptions(options: DefinedInitialDataOptions): DefinedInitialDataOptions & { queryKey: DataTag; }; /** * Allows to share and re-use query options in a type-safe way. * * The `queryKey` will be tagged with the type from `queryFn`. * * **Example** * * ```ts * const { queryKey } = queryOptions({ * queryKey: ['key'], * queryFn: () => Promise.resolve(5), * // ^? Promise * }) * * const queryClient = new QueryClient() * const data = queryClient.getQueryData(queryKey) * // ^? number | undefined * ``` * @param options - The query options to tag with the type from `queryFn`. * @returns The tagged query options. */ export declare function queryOptions(options: UnusedSkipTokenOptions): UnusedSkipTokenOptions & { queryKey: DataTag; }; /** * Allows to share and re-use query options in a type-safe way. * * The `queryKey` will be tagged with the type from `queryFn`. * * **Example** * * ```ts * const { queryKey } = queryOptions({ * queryKey: ['key'], * queryFn: () => Promise.resolve(5), * // ^? Promise * }) * * const queryClient = new QueryClient() * const data = queryClient.getQueryData(queryKey) * // ^? number | undefined * ``` * @param options - The query options to tag with the type from `queryFn`. * @returns The tagged query options. */ export declare function queryOptions(options: UndefinedInitialDataOptions): UndefinedInitialDataOptions & { queryKey: DataTag; };