import { DefaultError, InitialDataFunction, NonUndefinedGuard, OmitKeyof, QueryFunction, QueryKey, QueryKeyWithDataTag, 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 sharing and re-using 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 & QueryKeyWithDataTag; /** * Allows sharing and re-using 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 & QueryKeyWithDataTag; /** * Allows sharing and re-using 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 & QueryKeyWithDataTag;