import { UseQueryResult, UseQueryOptions, DefinedUseQueryResult } from './types.cjs'; import { DefaultError, QueryClient, QueryKey, OmitKeyof, QueriesPlaceholderDataFunction, QueryFunction, ThrowOnError } from '@tanstack/query-core'; type UseQueryOptionsForUseQueries = OmitKeyof, 'placeholderData'> & { placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction; }; type MAXIMUM_DEPTH = 20; type SkipTokenForUseQueries = symbol; type GetUseQueryOptionsForUseQueries = T extends { queryFnData: infer TQueryFnData; error?: infer TError; data: infer TData; } ? UseQueryOptionsForUseQueries : T extends { queryFnData: infer TQueryFnData; error?: infer TError; } ? UseQueryOptionsForUseQueries : T extends { data: infer TData; error?: infer TError; } ? UseQueryOptionsForUseQueries : T extends [infer TQueryFnData, infer TError, infer TData] ? UseQueryOptionsForUseQueries : T extends [infer TQueryFnData, infer TError] ? UseQueryOptionsForUseQueries : T extends [infer TQueryFnData] ? UseQueryOptionsForUseQueries : T extends { queryFn?: QueryFunction | SkipTokenForUseQueries; select?: (data: any) => infer TData; throwOnError?: ThrowOnError; } ? UseQueryOptionsForUseQueries : UseQueryOptionsForUseQueries; type GetDefinedOrUndefinedQueryResult = T extends { initialData?: infer TInitialData; } ? unknown extends TInitialData ? UseQueryResult : TInitialData extends TData ? DefinedUseQueryResult : TInitialData extends () => infer TInitialDataResult ? unknown extends TInitialDataResult ? UseQueryResult : TInitialDataResult extends TData ? DefinedUseQueryResult : UseQueryResult : UseQueryResult : UseQueryResult; type GetUseQueryResult = T extends { queryFnData: any; error?: infer TError; data: infer TData; } ? GetDefinedOrUndefinedQueryResult : T extends { queryFnData: infer TQueryFnData; error?: infer TError; } ? GetDefinedOrUndefinedQueryResult : T extends { data: infer TData; error?: infer TError; } ? GetDefinedOrUndefinedQueryResult : T extends [any, infer TError, infer TData] ? GetDefinedOrUndefinedQueryResult : T extends [infer TQueryFnData, infer TError] ? GetDefinedOrUndefinedQueryResult : T extends [infer TQueryFnData] ? GetDefinedOrUndefinedQueryResult : T extends { queryFn?: QueryFunction | SkipTokenForUseQueries; select?: (data: any) => infer TData; throwOnError?: ThrowOnError; } ? GetDefinedOrUndefinedQueryResult : UseQueryResult; /** * QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param */ type QueriesOptions, TResults extends Array = [], TDepth extends ReadonlyArray = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseQueryOptionsForUseQueries] : T extends [infer Head, ...infer Tails] ? QueriesOptions<[ ...Tails ], [ ...TResults, GetUseQueryOptionsForUseQueries ], [ ...TDepth, 1 ]> : ReadonlyArray extends T ? T : T extends Array> ? Array> : Array; /** * QueriesResults reducer recursively maps type param to results */ type QueriesResults, TResults extends Array = [], TDepth extends ReadonlyArray = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseQueryResult] : T extends [infer Head, ...infer Tails] ? QueriesResults<[ ...Tails ], [ ...TResults, GetUseQueryResult ], [ ...TDepth, 1 ]> : T extends Array> ? Array> : Array; declare function useQueries, TCombinedResult = QueriesResults>({ queries, ...options }: { queries: readonly [...QueriesOptions]; combine?: (result: QueriesResults) => TCombinedResult; }, queryClient?: QueryClient): TCombinedResult; export { type QueriesOptions, type QueriesResults, useQueries };