diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3d4f288f1293b..f3db4943cbfac 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5601,6 +5601,44 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const container = getParentOfSymbol(symbol); // Type parameters end up in the `members` lists but are not externally visible if (container && !(symbol.flags & SymbolFlags.TypeParameter)) { + return getWithAlternativeContainers(container); + } + const candidates = mapDefined(symbol.declarations, d => { + if (!isAmbientModule(d) && d.parent) { + // direct children of a module + if (hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) { + return getSymbolOfDeclaration(d.parent as Declaration); + } + // export ='d member of an ambient module + if (isModuleBlock(d.parent) && d.parent.parent && resolveExternalModuleSymbol(getSymbolOfDeclaration(d.parent.parent)) === symbol) { + return getSymbolOfDeclaration(d.parent.parent); + } + } + if (isClassExpression(d) && isBinaryExpression(d.parent) && d.parent.operatorToken.kind === SyntaxKind.EqualsToken && isAccessExpression(d.parent.left) && isEntityNameExpression(d.parent.left.expression)) { + if (isModuleExportsAccessExpression(d.parent.left) || isExportsIdentifier(d.parent.left.expression)) { + return getSymbolOfDeclaration(getSourceFileOfNode(d)); + } + checkExpressionCached(d.parent.left.expression); + return getNodeLinks(d.parent.left.expression).resolvedSymbol; + } + }); + if (!length(candidates)) { + return undefined; + } + const containers = mapDefined(candidates, candidate => getAliasForSymbolInContainer(candidate, symbol) ? candidate : undefined); + + let bestContainers: Symbol[] = []; + let alternativeContainers: Symbol[] = []; + + for (const container of containers) { + const [bestMatch, ...rest] = getWithAlternativeContainers(container); + bestContainers = append(bestContainers, bestMatch); + alternativeContainers = addRange(alternativeContainers, rest); + } + + return concatenate(bestContainers, alternativeContainers); + + function getWithAlternativeContainers(container: Symbol) { const additionalContainers = mapDefined(container.declarations, fileSymbolIfFileSymbolExportEqualsContainer); const reexportContainers = enclosingDeclaration && getAlternativeContainingModules(symbol, enclosingDeclaration); const objectLiteralContainer = getVariableDeclarationOfObjectLiteral(container, meaning); @@ -5629,29 +5667,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { res = addRange(res, reexportContainers); return res; } - const candidates = mapDefined(symbol.declarations, d => { - if (!isAmbientModule(d) && d.parent) { - // direct children of a module - if (hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) { - return getSymbolOfDeclaration(d.parent as Declaration); - } - // export ='d member of an ambient module - if (isModuleBlock(d.parent) && d.parent.parent && resolveExternalModuleSymbol(getSymbolOfDeclaration(d.parent.parent)) === symbol) { - return getSymbolOfDeclaration(d.parent.parent); - } - } - if (isClassExpression(d) && isBinaryExpression(d.parent) && d.parent.operatorToken.kind === SyntaxKind.EqualsToken && isAccessExpression(d.parent.left) && isEntityNameExpression(d.parent.left.expression)) { - if (isModuleExportsAccessExpression(d.parent.left) || isExportsIdentifier(d.parent.left.expression)) { - return getSymbolOfDeclaration(getSourceFileOfNode(d)); - } - checkExpressionCached(d.parent.left.expression); - return getNodeLinks(d.parent.left.expression).resolvedSymbol; - } - }); - if (!length(candidates)) { - return undefined; - } - return mapDefined(candidates, candidate => getAliasForSymbolInContainer(candidate, symbol) ? candidate : undefined); function fileSymbolIfFileSymbolExportEqualsContainer(d: Declaration) { return container && getFileSymbolIfFileSymbolExportEqualsContainer(d, container); diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.js b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.js new file mode 100644 index 0000000000000..73a3dd98d3901 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.js @@ -0,0 +1,273 @@ +//// [tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts] //// + +//// [useQuery-CPqkvEsh.d.ts] +type QueryKey = ReadonlyArray; + +interface Register {} + +type DefaultError = Register extends { + defaultError: infer TError; +} + ? TError + : Error; + +type ShouldRetryFunction = ( + failureCount: number, + error: TError, +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; + +type QueryFunctionContext< + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = [TPageParam] extends [never] + ? { + queryKey: TQueryKey; + } + : { + queryKey: TQueryKey; + pageParam: TPageParam; + }; + +type QueryFunction< + T = unknown, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = (context: QueryFunctionContext) => T | Promise; + +interface QueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> { + retry?: RetryValue; + queryFn?: QueryFunction; + queryKey?: TQueryKey; + initialData?: TData; + initialDataUpdatedAt?: number | (() => number | undefined); +} + +interface QueryObserverOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> extends QueryOptions< + TQueryFnData, + TError, + TQueryData, + TQueryKey, + TPageParam + > { + enabled?: boolean; + refetchInterval?: number; + select?: (data: TQueryData) => TData; +} + +type UseQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = { + [Property in keyof QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >]: QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >[Property]; +}; + +type UndefinedInitialQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions & { + initialData?: undefined; +}; + +interface QueryObserverBaseResult { + data: TData | undefined; + dataUpdatedAt: number; + error: TError | null; + errorUpdatedAt: number; + failureCount: number; + failureReason: TError | null; + errorUpdateCount: number; + isError: boolean; + isFetched: boolean; + isFetchedAfterMount: boolean; + isFetching: boolean; + isLoading: boolean; + isPending: boolean; + isLoadingError: boolean; + isInitialLoading: boolean; + isPaused: boolean; + isPlaceholderData: boolean; + isRefetchError: boolean; + isRefetching: boolean; + isStale: boolean; + isSuccess: boolean; +} + +interface QueryObserverSuccessResult + extends QueryObserverBaseResult { + data: TData; + error: null; + isError: false; + isPending: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + status: "success"; +} + +type DefinedQueryObserverResult< + TData = unknown, + TError = DefaultError, +> = QueryObserverSuccessResult; +type QueryObserverResult< + TData = unknown, + TError = DefaultError, +> = DefinedQueryObserverResult; + +type ToRef = { + value: T; +}; + +type UseBaseQueryReturnType< + TData, + TError, + Result = QueryObserverResult, +> = { + [K in keyof Result]: K extends + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] + : ToRef[K]>; +} & { + suspense: () => Promise; +}; + +type UseQueryReturnType = UseBaseQueryReturnType; + +declare function useQuery< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +>( + options: UndefinedInitialQueryOptions, +): UseQueryReturnType; + +export { type UseQueryReturnType, useQuery }; + +//// [index.d.ts] +export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; + +//// [package.json] +{ + "name": "@tanstack/vue-query", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./build/modern/index.d.ts", + "default": "./build/modern/index.js" + }, + "require": { + "types": "./build/modern/index.d.cts", + "default": "./build/modern/index.cjs" + } + } + } +} + +//// [index.mts] +import { useQuery } from '@tanstack/vue-query' + +const baseUrl = 'https://api.publicapis.org/' + +interface IEntry { + API: string + Description: string + Auth: string + HTTPS: boolean + Cors: string + Link: string + Category: string +} + +const testApi = { + getEntries: (): Promise => { + return fetch(baseUrl + 'entries') + .then((res) => res.json()) + .then((data) => data.entries) + .catch((err) => console.log(err)) + } +} + +const entryKeys = { + all: ['entries'] as const, + list: () => [...entryKeys.all, 'list'] as const +} + +export const useEntries = () => { + return useQuery({ + queryKey: entryKeys.list(), + queryFn: testApi.getEntries, + select: (data) => data.slice(0, 10) + }) +} + + +//// [index.mjs] +import { useQuery } from '@tanstack/vue-query'; +const baseUrl = 'https://api.publicapis.org/'; +const testApi = { + getEntries: () => { + return fetch(baseUrl + 'entries') + .then((res) => res.json()) + .then((data) => data.entries) + .catch((err) => console.log(err)); + } +}; +const entryKeys = { + all: ['entries'], + list: () => [...entryKeys.all, 'list'] +}; +export const useEntries = () => { + return useQuery({ + queryKey: entryKeys.list(), + queryFn: testApi.getEntries, + select: (data) => data.slice(0, 10) + }); +}; + + +//// [index.d.mts] +interface IEntry { + API: string; + Description: string; + Auth: string; + HTTPS: boolean; + Cors: string; + Link: string; + Category: string; +} +export declare const useEntries: () => import("@tanstack/vue-query").UseQueryReturnType; +export {}; diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.symbols b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.symbols new file mode 100644 index 0000000000000..55642da2f56e4 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.symbols @@ -0,0 +1,653 @@ +//// [tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts] //// + +=== node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts === +type QueryKey = ReadonlyArray; +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 3 more) + +interface Register {} +>Register : Symbol(Register, Decl(useQuery-CPqkvEsh.d.ts, 0, 39)) + +type DefaultError = Register extends { +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) +>Register : Symbol(Register, Decl(useQuery-CPqkvEsh.d.ts, 0, 39)) + + defaultError: infer TError; +>defaultError : Symbol(defaultError, Decl(useQuery-CPqkvEsh.d.ts, 4, 38)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 5, 21)) +} + ? TError +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 5, 21)) + + : Error; +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) + +type ShouldRetryFunction = ( +>ShouldRetryFunction : Symbol(ShouldRetryFunction, Decl(useQuery-CPqkvEsh.d.ts, 8, 10)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 10, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + failureCount: number, +>failureCount : Symbol(failureCount, Decl(useQuery-CPqkvEsh.d.ts, 10, 51)) + + error: TError, +>error : Symbol(error, Decl(useQuery-CPqkvEsh.d.ts, 11, 23)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 10, 25)) + +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; +>RetryValue : Symbol(RetryValue, Decl(useQuery-CPqkvEsh.d.ts, 13, 13)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 14, 16)) +>ShouldRetryFunction : Symbol(ShouldRetryFunction, Decl(useQuery-CPqkvEsh.d.ts, 8, 10)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 14, 16)) + +type QueryFunctionContext< +>QueryFunctionContext : Symbol(QueryFunctionContext, Decl(useQuery-CPqkvEsh.d.ts, 14, 73)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 16, 26)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 17, 40)) + +> = [TPageParam] extends [never] +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 17, 40)) + + ? { + queryKey: TQueryKey; +>queryKey : Symbol(queryKey, Decl(useQuery-CPqkvEsh.d.ts, 20, 5)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 16, 26)) + } + : { + queryKey: TQueryKey; +>queryKey : Symbol(queryKey, Decl(useQuery-CPqkvEsh.d.ts, 23, 5)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 16, 26)) + + pageParam: TPageParam; +>pageParam : Symbol(pageParam, Decl(useQuery-CPqkvEsh.d.ts, 24, 26)) +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 17, 40)) + + }; + +type QueryFunction< +>QueryFunction : Symbol(QueryFunction, Decl(useQuery-CPqkvEsh.d.ts, 26, 6)) + + T = unknown, +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 28, 19)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 29, 14)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 30, 40)) + +> = (context: QueryFunctionContext) => T | Promise; +>context : Symbol(context, Decl(useQuery-CPqkvEsh.d.ts, 32, 5)) +>QueryFunctionContext : Symbol(QueryFunctionContext, Decl(useQuery-CPqkvEsh.d.ts, 14, 73)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 29, 14)) +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 30, 40)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 28, 19)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 28, 19)) + +interface QueryOptions< +>QueryOptions : Symbol(QueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 32, 77)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 34, 23)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 35, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 36, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 34, 23)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 37, 23)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 38, 40)) + +> { + retry?: RetryValue; +>retry : Symbol(QueryOptions.retry, Decl(useQuery-CPqkvEsh.d.ts, 40, 3)) +>RetryValue : Symbol(RetryValue, Decl(useQuery-CPqkvEsh.d.ts, 13, 13)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 35, 25)) + + queryFn?: QueryFunction; +>queryFn : Symbol(QueryOptions.queryFn, Decl(useQuery-CPqkvEsh.d.ts, 41, 29)) +>QueryFunction : Symbol(QueryFunction, Decl(useQuery-CPqkvEsh.d.ts, 26, 6)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 34, 23)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 37, 23)) +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 38, 40)) + + queryKey?: TQueryKey; +>queryKey : Symbol(QueryOptions.queryKey, Decl(useQuery-CPqkvEsh.d.ts, 42, 63)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 37, 23)) + + initialData?: TData; +>initialData : Symbol(QueryOptions.initialData, Decl(useQuery-CPqkvEsh.d.ts, 43, 23)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 36, 24)) + + initialDataUpdatedAt?: number | (() => number | undefined); +>initialDataUpdatedAt : Symbol(QueryOptions.initialDataUpdatedAt, Decl(useQuery-CPqkvEsh.d.ts, 44, 22)) +} + +interface QueryObserverOptions< +>QueryObserverOptions : Symbol(QueryObserverOptions, Decl(useQuery-CPqkvEsh.d.ts, 46, 1)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 49, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 50, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TQueryData = TQueryFnData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 51, 23)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 52, 28)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 53, 40)) + +> extends QueryOptions< +>QueryOptions : Symbol(QueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 32, 77)) + + TQueryFnData, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 49, 25)) + + TQueryData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 51, 23)) + + TQueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 52, 28)) + + TPageParam +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 53, 40)) + + > { + enabled?: boolean; +>enabled : Symbol(QueryObserverOptions.enabled, Decl(useQuery-CPqkvEsh.d.ts, 61, 5)) + + refetchInterval?: number; +>refetchInterval : Symbol(QueryObserverOptions.refetchInterval, Decl(useQuery-CPqkvEsh.d.ts, 62, 20)) + + select?: (data: TQueryData) => TData; +>select : Symbol(QueryObserverOptions.select, Decl(useQuery-CPqkvEsh.d.ts, 63, 27)) +>data : Symbol(data, Decl(useQuery-CPqkvEsh.d.ts, 64, 12)) +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 51, 23)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 50, 24)) +} + +type UseQueryOptions< +>UseQueryOptions : Symbol(UseQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 65, 1)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 68, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 69, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TQueryData = TQueryFnData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 70, 23)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 71, 28)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + +> = { + [Property in keyof QueryObserverOptions< +>Property : Symbol(Property, Decl(useQuery-CPqkvEsh.d.ts, 74, 3)) +>QueryObserverOptions : Symbol(QueryObserverOptions, Decl(useQuery-CPqkvEsh.d.ts, 46, 1)) + + TQueryFnData, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 68, 25)) + + TData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 69, 24)) + + TQueryData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 70, 23)) + + TQueryKey +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 71, 28)) + + >]: QueryObserverOptions< +>QueryObserverOptions : Symbol(QueryObserverOptions, Decl(useQuery-CPqkvEsh.d.ts, 46, 1)) + + TQueryFnData, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 68, 25)) + + TData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 69, 24)) + + TQueryData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 70, 23)) + + TQueryKey +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 71, 28)) + + >[Property]; +>Property : Symbol(Property, Decl(useQuery-CPqkvEsh.d.ts, 74, 3)) + +}; + +type UndefinedInitialQueryOptions< +>UndefinedInitialQueryOptions : Symbol(UndefinedInitialQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 87, 2)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 90, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 91, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 92, 23)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + +> = UseQueryOptions & { +>UseQueryOptions : Symbol(UseQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 65, 1)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 90, 25)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 91, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 92, 23)) + + initialData?: undefined; +>initialData : Symbol(initialData, Decl(useQuery-CPqkvEsh.d.ts, 94, 77)) + +}; + +interface QueryObserverBaseResult { +>QueryObserverBaseResult : Symbol(QueryObserverBaseResult, Decl(useQuery-CPqkvEsh.d.ts, 96, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 98, 34)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 98, 50)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + data: TData | undefined; +>data : Symbol(QueryObserverBaseResult.data, Decl(useQuery-CPqkvEsh.d.ts, 98, 75)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 98, 34)) + + dataUpdatedAt: number; +>dataUpdatedAt : Symbol(QueryObserverBaseResult.dataUpdatedAt, Decl(useQuery-CPqkvEsh.d.ts, 99, 26)) + + error: TError | null; +>error : Symbol(QueryObserverBaseResult.error, Decl(useQuery-CPqkvEsh.d.ts, 100, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 98, 50)) + + errorUpdatedAt: number; +>errorUpdatedAt : Symbol(QueryObserverBaseResult.errorUpdatedAt, Decl(useQuery-CPqkvEsh.d.ts, 101, 23)) + + failureCount: number; +>failureCount : Symbol(QueryObserverBaseResult.failureCount, Decl(useQuery-CPqkvEsh.d.ts, 102, 25)) + + failureReason: TError | null; +>failureReason : Symbol(QueryObserverBaseResult.failureReason, Decl(useQuery-CPqkvEsh.d.ts, 103, 23)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 98, 50)) + + errorUpdateCount: number; +>errorUpdateCount : Symbol(QueryObserverBaseResult.errorUpdateCount, Decl(useQuery-CPqkvEsh.d.ts, 104, 31)) + + isError: boolean; +>isError : Symbol(QueryObserverBaseResult.isError, Decl(useQuery-CPqkvEsh.d.ts, 105, 27)) + + isFetched: boolean; +>isFetched : Symbol(QueryObserverBaseResult.isFetched, Decl(useQuery-CPqkvEsh.d.ts, 106, 19)) + + isFetchedAfterMount: boolean; +>isFetchedAfterMount : Symbol(QueryObserverBaseResult.isFetchedAfterMount, Decl(useQuery-CPqkvEsh.d.ts, 107, 21)) + + isFetching: boolean; +>isFetching : Symbol(QueryObserverBaseResult.isFetching, Decl(useQuery-CPqkvEsh.d.ts, 108, 31)) + + isLoading: boolean; +>isLoading : Symbol(QueryObserverBaseResult.isLoading, Decl(useQuery-CPqkvEsh.d.ts, 109, 22)) + + isPending: boolean; +>isPending : Symbol(QueryObserverBaseResult.isPending, Decl(useQuery-CPqkvEsh.d.ts, 110, 21)) + + isLoadingError: boolean; +>isLoadingError : Symbol(QueryObserverBaseResult.isLoadingError, Decl(useQuery-CPqkvEsh.d.ts, 111, 21)) + + isInitialLoading: boolean; +>isInitialLoading : Symbol(QueryObserverBaseResult.isInitialLoading, Decl(useQuery-CPqkvEsh.d.ts, 112, 26)) + + isPaused: boolean; +>isPaused : Symbol(QueryObserverBaseResult.isPaused, Decl(useQuery-CPqkvEsh.d.ts, 113, 28)) + + isPlaceholderData: boolean; +>isPlaceholderData : Symbol(QueryObserverBaseResult.isPlaceholderData, Decl(useQuery-CPqkvEsh.d.ts, 114, 20)) + + isRefetchError: boolean; +>isRefetchError : Symbol(QueryObserverBaseResult.isRefetchError, Decl(useQuery-CPqkvEsh.d.ts, 115, 29)) + + isRefetching: boolean; +>isRefetching : Symbol(QueryObserverBaseResult.isRefetching, Decl(useQuery-CPqkvEsh.d.ts, 116, 26)) + + isStale: boolean; +>isStale : Symbol(QueryObserverBaseResult.isStale, Decl(useQuery-CPqkvEsh.d.ts, 117, 24)) + + isSuccess: boolean; +>isSuccess : Symbol(QueryObserverBaseResult.isSuccess, Decl(useQuery-CPqkvEsh.d.ts, 118, 19)) +} + +interface QueryObserverSuccessResult +>QueryObserverSuccessResult : Symbol(QueryObserverSuccessResult, Decl(useQuery-CPqkvEsh.d.ts, 120, 1)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 122, 37)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 122, 53)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + extends QueryObserverBaseResult { +>QueryObserverBaseResult : Symbol(QueryObserverBaseResult, Decl(useQuery-CPqkvEsh.d.ts, 96, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 122, 37)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 122, 53)) + + data: TData; +>data : Symbol(QueryObserverSuccessResult.data, Decl(useQuery-CPqkvEsh.d.ts, 123, 50)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 122, 37)) + + error: null; +>error : Symbol(QueryObserverSuccessResult.error, Decl(useQuery-CPqkvEsh.d.ts, 124, 14)) + + isError: false; +>isError : Symbol(QueryObserverSuccessResult.isError, Decl(useQuery-CPqkvEsh.d.ts, 125, 14)) + + isPending: false; +>isPending : Symbol(QueryObserverSuccessResult.isPending, Decl(useQuery-CPqkvEsh.d.ts, 126, 17)) + + isLoadingError: false; +>isLoadingError : Symbol(QueryObserverSuccessResult.isLoadingError, Decl(useQuery-CPqkvEsh.d.ts, 127, 19)) + + isRefetchError: false; +>isRefetchError : Symbol(QueryObserverSuccessResult.isRefetchError, Decl(useQuery-CPqkvEsh.d.ts, 128, 24)) + + isSuccess: true; +>isSuccess : Symbol(QueryObserverSuccessResult.isSuccess, Decl(useQuery-CPqkvEsh.d.ts, 129, 24)) + + status: "success"; +>status : Symbol(QueryObserverSuccessResult.status, Decl(useQuery-CPqkvEsh.d.ts, 130, 18)) +} + +type DefinedQueryObserverResult< +>DefinedQueryObserverResult : Symbol(DefinedQueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 132, 1)) + + TData = unknown, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 134, 32)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 135, 18)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + +> = QueryObserverSuccessResult; +>QueryObserverSuccessResult : Symbol(QueryObserverSuccessResult, Decl(useQuery-CPqkvEsh.d.ts, 120, 1)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 134, 32)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 135, 18)) + +type QueryObserverResult< +>QueryObserverResult : Symbol(QueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 137, 46)) + + TData = unknown, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 138, 25)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 139, 18)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + +> = DefinedQueryObserverResult; +>DefinedQueryObserverResult : Symbol(DefinedQueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 132, 1)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 138, 25)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 139, 18)) + +type ToRef = { +>ToRef : Symbol(ToRef, Decl(useQuery-CPqkvEsh.d.ts, 141, 46)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 143, 11)) + + value: T; +>value : Symbol(value, Decl(useQuery-CPqkvEsh.d.ts, 143, 17)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 143, 11)) + +}; + +type UseBaseQueryReturnType< +>UseBaseQueryReturnType : Symbol(UseBaseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 145, 2)) + + TData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 147, 28)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 148, 8)) + + Result = QueryObserverResult, +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>QueryObserverResult : Symbol(QueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 137, 46)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 147, 28)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 148, 8)) + +> = { + [K in keyof Result]: K extends +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) + + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) + + : ToRef[K]>; +>ToRef : Symbol(ToRef, Decl(useQuery-CPqkvEsh.d.ts, 141, 46)) +>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --)) +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) + +} & { + suspense: () => Promise; +>suspense : Symbol(suspense, Decl(useQuery-CPqkvEsh.d.ts, 158, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) + +}; + +type UseQueryReturnType = UseBaseQueryReturnType; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 160, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 162, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 162, 30)) +>UseBaseQueryReturnType : Symbol(UseBaseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 145, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 162, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 162, 30)) + +declare function useQuery< +>useQuery : Symbol(useQuery, Decl(useQuery-CPqkvEsh.d.ts, 162, 79)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 164, 26)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 165, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 166, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 164, 26)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 167, 23)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + +>( + options: UndefinedInitialQueryOptions, +>options : Symbol(options, Decl(useQuery-CPqkvEsh.d.ts, 169, 2)) +>UndefinedInitialQueryOptions : Symbol(UndefinedInitialQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 87, 2)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 164, 26)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 165, 25)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 166, 24)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 167, 23)) + +): UseQueryReturnType; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 160, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 166, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 165, 25)) + +export { type UseQueryReturnType, useQuery }; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 173, 8)) +>useQuery : Symbol(useQuery, Decl(useQuery-CPqkvEsh.d.ts, 173, 33)) + +=== node_modules/@tanstack/vue-query/build/modern/index.d.ts === +export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(index.d.ts, 0, 8)) +>useQuery : Symbol(useQuery, Decl(index.d.ts, 0, 28)) + +=== src/index.mts === +import { useQuery } from '@tanstack/vue-query' +>useQuery : Symbol(useQuery, Decl(index.mts, 0, 8)) + +const baseUrl = 'https://api.publicapis.org/' +>baseUrl : Symbol(baseUrl, Decl(index.mts, 2, 5)) + +interface IEntry { +>IEntry : Symbol(IEntry, Decl(index.mts, 2, 45)) + + API: string +>API : Symbol(IEntry.API, Decl(index.mts, 4, 18)) + + Description: string +>Description : Symbol(IEntry.Description, Decl(index.mts, 5, 13)) + + Auth: string +>Auth : Symbol(IEntry.Auth, Decl(index.mts, 6, 21)) + + HTTPS: boolean +>HTTPS : Symbol(IEntry.HTTPS, Decl(index.mts, 7, 14)) + + Cors: string +>Cors : Symbol(IEntry.Cors, Decl(index.mts, 8, 16)) + + Link: string +>Link : Symbol(IEntry.Link, Decl(index.mts, 9, 14)) + + Category: string +>Category : Symbol(IEntry.Category, Decl(index.mts, 10, 14)) +} + +const testApi = { +>testApi : Symbol(testApi, Decl(index.mts, 14, 5)) + + getEntries: (): Promise => { +>getEntries : Symbol(getEntries, Decl(index.mts, 14, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>IEntry : Symbol(IEntry, Decl(index.mts, 2, 45)) + + return fetch(baseUrl + 'entries') +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --)) +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>fetch(baseUrl + 'entries') .then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --)) +>baseUrl : Symbol(baseUrl, Decl(index.mts, 2, 5)) + + .then((res) => res.json()) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>res : Symbol(res, Decl(index.mts, 17, 13)) +>res.json : Symbol(Body.json, Decl(lib.dom.d.ts, --, --)) +>res : Symbol(res, Decl(index.mts, 17, 13)) +>json : Symbol(Body.json, Decl(lib.dom.d.ts, --, --)) + + .then((data) => data.entries) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>data : Symbol(data, Decl(index.mts, 18, 13)) +>data : Symbol(data, Decl(index.mts, 18, 13)) + + .catch((err) => console.log(err)) +>catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --)) +>err : Symbol(err, Decl(index.mts, 19, 14)) +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>err : Symbol(err, Decl(index.mts, 19, 14)) + } +} + +const entryKeys = { +>entryKeys : Symbol(entryKeys, Decl(index.mts, 23, 5)) + + all: ['entries'] as const, +>all : Symbol(all, Decl(index.mts, 23, 19)) +>const : Symbol(const) + + list: () => [...entryKeys.all, 'list'] as const +>list : Symbol(list, Decl(index.mts, 24, 28)) +>entryKeys.all : Symbol(all, Decl(index.mts, 23, 19)) +>entryKeys : Symbol(entryKeys, Decl(index.mts, 23, 5)) +>all : Symbol(all, Decl(index.mts, 23, 19)) +>const : Symbol(const) +} + +export const useEntries = () => { +>useEntries : Symbol(useEntries, Decl(index.mts, 28, 12)) + + return useQuery({ +>useQuery : Symbol(useQuery, Decl(index.mts, 0, 8)) + + queryKey: entryKeys.list(), +>queryKey : Symbol(queryKey, Decl(index.mts, 29, 19)) +>entryKeys.list : Symbol(list, Decl(index.mts, 24, 28)) +>entryKeys : Symbol(entryKeys, Decl(index.mts, 23, 5)) +>list : Symbol(list, Decl(index.mts, 24, 28)) + + queryFn: testApi.getEntries, +>queryFn : Symbol(queryFn, Decl(index.mts, 30, 31)) +>testApi.getEntries : Symbol(getEntries, Decl(index.mts, 14, 17)) +>testApi : Symbol(testApi, Decl(index.mts, 14, 5)) +>getEntries : Symbol(getEntries, Decl(index.mts, 14, 17)) + + select: (data) => data.slice(0, 10) +>select : Symbol(select, Decl(index.mts, 31, 32)) +>data : Symbol(data, Decl(index.mts, 32, 13)) +>data.slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --)) +>data : Symbol(data, Decl(index.mts, 32, 13)) +>slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --)) + + }) +} + diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.types b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.types new file mode 100644 index 0000000000000..3e4b04385237a --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.types @@ -0,0 +1,444 @@ +//// [tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts] //// + +=== node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts === +type QueryKey = ReadonlyArray; +>QueryKey : readonly unknown[] + +interface Register {} + +type DefaultError = Register extends { +>DefaultError : Error + + defaultError: infer TError; +>defaultError : TError +} + ? TError + : Error; + +type ShouldRetryFunction = ( +>ShouldRetryFunction : ShouldRetryFunction + + failureCount: number, +>failureCount : number + + error: TError, +>error : TError + +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; +>RetryValue : RetryValue + +type QueryFunctionContext< +>QueryFunctionContext : QueryFunctionContext + + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = [TPageParam] extends [never] + ? { + queryKey: TQueryKey; +>queryKey : TQueryKey + } + : { + queryKey: TQueryKey; +>queryKey : TQueryKey + + pageParam: TPageParam; +>pageParam : TPageParam + + }; + +type QueryFunction< +>QueryFunction : QueryFunction + + T = unknown, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = (context: QueryFunctionContext) => T | Promise; +>context : QueryFunctionContext + +interface QueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> { + retry?: RetryValue; +>retry : RetryValue | undefined + + queryFn?: QueryFunction; +>queryFn : QueryFunction | undefined + + queryKey?: TQueryKey; +>queryKey : TQueryKey | undefined + + initialData?: TData; +>initialData : TData | undefined + + initialDataUpdatedAt?: number | (() => number | undefined); +>initialDataUpdatedAt : number | (() => number | undefined) | undefined +} + +interface QueryObserverOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> extends QueryOptions< + TQueryFnData, + TError, + TQueryData, + TQueryKey, + TPageParam + > { + enabled?: boolean; +>enabled : boolean | undefined + + refetchInterval?: number; +>refetchInterval : number | undefined + + select?: (data: TQueryData) => TData; +>select : ((data: TQueryData) => TData) | undefined +>data : TQueryData +} + +type UseQueryOptions< +>UseQueryOptions : UseQueryOptions + + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = { + [Property in keyof QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >]: QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >[Property]; +}; + +type UndefinedInitialQueryOptions< +>UndefinedInitialQueryOptions : UndefinedInitialQueryOptions + + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions & { + initialData?: undefined; +>initialData : undefined + +}; + +interface QueryObserverBaseResult { + data: TData | undefined; +>data : TData | undefined + + dataUpdatedAt: number; +>dataUpdatedAt : number + + error: TError | null; +>error : TError | null + + errorUpdatedAt: number; +>errorUpdatedAt : number + + failureCount: number; +>failureCount : number + + failureReason: TError | null; +>failureReason : TError | null + + errorUpdateCount: number; +>errorUpdateCount : number + + isError: boolean; +>isError : boolean + + isFetched: boolean; +>isFetched : boolean + + isFetchedAfterMount: boolean; +>isFetchedAfterMount : boolean + + isFetching: boolean; +>isFetching : boolean + + isLoading: boolean; +>isLoading : boolean + + isPending: boolean; +>isPending : boolean + + isLoadingError: boolean; +>isLoadingError : boolean + + isInitialLoading: boolean; +>isInitialLoading : boolean + + isPaused: boolean; +>isPaused : boolean + + isPlaceholderData: boolean; +>isPlaceholderData : boolean + + isRefetchError: boolean; +>isRefetchError : boolean + + isRefetching: boolean; +>isRefetching : boolean + + isStale: boolean; +>isStale : boolean + + isSuccess: boolean; +>isSuccess : boolean +} + +interface QueryObserverSuccessResult + extends QueryObserverBaseResult { + data: TData; +>data : TData + + error: null; +>error : null + + isError: false; +>isError : false +>false : false + + isPending: false; +>isPending : false +>false : false + + isLoadingError: false; +>isLoadingError : false +>false : false + + isRefetchError: false; +>isRefetchError : false +>false : false + + isSuccess: true; +>isSuccess : true +>true : true + + status: "success"; +>status : "success" +} + +type DefinedQueryObserverResult< +>DefinedQueryObserverResult : DefinedQueryObserverResult + + TData = unknown, + TError = DefaultError, +> = QueryObserverSuccessResult; +type QueryObserverResult< +>QueryObserverResult : QueryObserverResult + + TData = unknown, + TError = DefaultError, +> = DefinedQueryObserverResult; + +type ToRef = { +>ToRef : ToRef + + value: T; +>value : T + +}; + +type UseBaseQueryReturnType< +>UseBaseQueryReturnType : UseBaseQueryReturnType + + TData, + TError, + Result = QueryObserverResult, +> = { + [K in keyof Result]: K extends + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] + : ToRef[K]>; +} & { + suspense: () => Promise; +>suspense : () => Promise + +}; + +type UseQueryReturnType = UseBaseQueryReturnType; +>UseQueryReturnType : UseQueryReturnType + +declare function useQuery< +>useQuery : (options: UndefinedInitialQueryOptions) => UseQueryReturnType + + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +>( + options: UndefinedInitialQueryOptions, +>options : UndefinedInitialQueryOptions + +): UseQueryReturnType; + +export { type UseQueryReturnType, useQuery }; +>UseQueryReturnType : any +>useQuery : (options: UndefinedInitialQueryOptions) => UseQueryReturnType + +=== node_modules/@tanstack/vue-query/build/modern/index.d.ts === +export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; +>UseQueryReturnType : any +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType + +=== src/index.mts === +import { useQuery } from '@tanstack/vue-query' +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType + +const baseUrl = 'https://api.publicapis.org/' +>baseUrl : "https://api.publicapis.org/" +>'https://api.publicapis.org/' : "https://api.publicapis.org/" + +interface IEntry { + API: string +>API : string + + Description: string +>Description : string + + Auth: string +>Auth : string + + HTTPS: boolean +>HTTPS : boolean + + Cors: string +>Cors : string + + Link: string +>Link : string + + Category: string +>Category : string +} + +const testApi = { +>testApi : { getEntries: () => Promise; } +>{ getEntries: (): Promise => { return fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch((err) => console.log(err)) }} : { getEntries: () => Promise; } + + getEntries: (): Promise => { +>getEntries : () => Promise +>(): Promise => { return fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch((err) => console.log(err)) } : () => Promise + + return fetch(baseUrl + 'entries') +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch((err) => console.log(err)) : Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) : Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then : (onfulfilled?: ((value: any) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) : Promise +>fetch(baseUrl + 'entries') .then : (onfulfilled?: ((value: Response) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>fetch(baseUrl + 'entries') : Promise +>fetch : (input: RequestInfo | URL, init?: RequestInit | undefined) => Promise +>baseUrl + 'entries' : string +>baseUrl : "https://api.publicapis.org/" +>'entries' : "entries" + + .then((res) => res.json()) +>then : (onfulfilled?: ((value: Response) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>(res) => res.json() : (res: Response) => Promise +>res : Response +>res.json() : Promise +>res.json : () => Promise +>res : Response +>json : () => Promise + + .then((data) => data.entries) +>then : (onfulfilled?: ((value: any) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>(data) => data.entries : (data: any) => any +>data : any +>data.entries : any +>data : any +>entries : any + + .catch((err) => console.log(err)) +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>(err) => console.log(err) : (err: any) => void +>err : any +>console.log(err) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>err : any + } +} + +const entryKeys = { +>entryKeys : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } +>{ all: ['entries'] as const, list: () => [...entryKeys.all, 'list'] as const} : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } + + all: ['entries'] as const, +>all : readonly ["entries"] +>['entries'] as const : readonly ["entries"] +>['entries'] : readonly ["entries"] +>'entries' : "entries" + + list: () => [...entryKeys.all, 'list'] as const +>list : () => readonly ["entries", "list"] +>() => [...entryKeys.all, 'list'] as const : () => readonly ["entries", "list"] +>[...entryKeys.all, 'list'] as const : readonly ["entries", "list"] +>[...entryKeys.all, 'list'] : readonly ["entries", "list"] +>...entryKeys.all : "entries" +>entryKeys.all : readonly ["entries"] +>entryKeys : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } +>all : readonly ["entries"] +>'list' : "list" +} + +export const useEntries = () => { +>useEntries : () => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType +>() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType + + return useQuery({ +>useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType +>{ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) } : { queryKey: readonly ["entries", "list"]; queryFn: () => Promise; select: (data: IEntry[]) => IEntry[]; } + + queryKey: entryKeys.list(), +>queryKey : readonly ["entries", "list"] +>entryKeys.list() : readonly ["entries", "list"] +>entryKeys.list : () => readonly ["entries", "list"] +>entryKeys : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } +>list : () => readonly ["entries", "list"] + + queryFn: testApi.getEntries, +>queryFn : () => Promise +>testApi.getEntries : () => Promise +>testApi : { getEntries: () => Promise; } +>getEntries : () => Promise + + select: (data) => data.slice(0, 10) +>select : (data: IEntry[]) => IEntry[] +>(data) => data.slice(0, 10) : (data: IEntry[]) => IEntry[] +>data : IEntry[] +>data.slice(0, 10) : IEntry[] +>data.slice : (start?: number | undefined, end?: number | undefined) => IEntry[] +>data : IEntry[] +>slice : (start?: number | undefined, end?: number | undefined) => IEntry[] +>0 : 0 +>10 : 10 + + }) +} + diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.js b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.js new file mode 100644 index 0000000000000..30edd83e29a80 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.js @@ -0,0 +1,273 @@ +//// [tests/cases/compiler/declarationEmitUsingAlternativeContainingModules2.ts] //// + +//// [useQuery-CPqkvEsh.d.ts] +type QueryKey = ReadonlyArray; + +interface Register {} + +type DefaultError = Register extends { + defaultError: infer TError; +} + ? TError + : Error; + +type ShouldRetryFunction = ( + failureCount: number, + error: TError, +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; + +type QueryFunctionContext< + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = [TPageParam] extends [never] + ? { + queryKey: TQueryKey; + } + : { + queryKey: TQueryKey; + pageParam: TPageParam; + }; + +type QueryFunction< + T = unknown, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = (context: QueryFunctionContext) => T | Promise; + +interface QueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> { + retry?: RetryValue; + queryFn?: QueryFunction; + queryKey?: TQueryKey; + initialData?: TData; + initialDataUpdatedAt?: number | (() => number | undefined); +} + +interface QueryObserverOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> extends QueryOptions< + TQueryFnData, + TError, + TQueryData, + TQueryKey, + TPageParam + > { + enabled?: boolean; + refetchInterval?: number; + select?: (data: TQueryData) => TData; +} + +type UseQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = { + [Property in keyof QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >]: QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >[Property]; +}; + +type UndefinedInitialQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions & { + initialData?: undefined; +}; + +interface QueryObserverBaseResult { + data: TData | undefined; + dataUpdatedAt: number; + error: TError | null; + errorUpdatedAt: number; + failureCount: number; + failureReason: TError | null; + errorUpdateCount: number; + isError: boolean; + isFetched: boolean; + isFetchedAfterMount: boolean; + isFetching: boolean; + isLoading: boolean; + isPending: boolean; + isLoadingError: boolean; + isInitialLoading: boolean; + isPaused: boolean; + isPlaceholderData: boolean; + isRefetchError: boolean; + isRefetching: boolean; + isStale: boolean; + isSuccess: boolean; +} + +interface QueryObserverSuccessResult + extends QueryObserverBaseResult { + data: TData; + error: null; + isError: false; + isPending: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + status: "success"; +} + +type DefinedQueryObserverResult< + TData = unknown, + TError = DefaultError, +> = QueryObserverSuccessResult; +type QueryObserverResult< + TData = unknown, + TError = DefaultError, +> = DefinedQueryObserverResult; + +type ToRef = { + value: T; +}; + +type UseBaseQueryReturnType< + TData, + TError, + Result = QueryObserverResult, +> = { + [K in keyof Result]: K extends + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] + : ToRef[K]>; +} & { + suspense: () => Promise; +}; + +type UseQueryReturnType = UseBaseQueryReturnType; + +declare function useQuery< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +>( + options: UndefinedInitialQueryOptions, +): UseQueryReturnType; + +export { type UseQueryReturnType as b, useQuery as u }; + +//// [index.d.ts] +export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; + +//// [package.json] +{ + "name": "@tanstack/vue-query", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./build/modern/index.d.ts", + "default": "./build/modern/index.js" + }, + "require": { + "types": "./build/modern/index.d.cts", + "default": "./build/modern/index.cjs" + } + } + } +} + +//// [index.mts] +import { useQuery } from '@tanstack/vue-query' + +const baseUrl = 'https://api.publicapis.org/' + +interface IEntry { + API: string + Description: string + Auth: string + HTTPS: boolean + Cors: string + Link: string + Category: string +} + +const testApi = { + getEntries: (): Promise => { + return fetch(baseUrl + 'entries') + .then((res) => res.json()) + .then((data) => data.entries) + .catch((err) => console.log(err)) + } +} + +const entryKeys = { + all: ['entries'] as const, + list: () => [...entryKeys.all, 'list'] as const +} + +export const useEntries = () => { + return useQuery({ + queryKey: entryKeys.list(), + queryFn: testApi.getEntries, + select: (data) => data.slice(0, 10) + }) +} + + +//// [index.mjs] +import { useQuery } from '@tanstack/vue-query'; +const baseUrl = 'https://api.publicapis.org/'; +const testApi = { + getEntries: () => { + return fetch(baseUrl + 'entries') + .then((res) => res.json()) + .then((data) => data.entries) + .catch((err) => console.log(err)); + } +}; +const entryKeys = { + all: ['entries'], + list: () => [...entryKeys.all, 'list'] +}; +export const useEntries = () => { + return useQuery({ + queryKey: entryKeys.list(), + queryFn: testApi.getEntries, + select: (data) => data.slice(0, 10) + }); +}; + + +//// [index.d.mts] +interface IEntry { + API: string; + Description: string; + Auth: string; + HTTPS: boolean; + Cors: string; + Link: string; + Category: string; +} +export declare const useEntries: () => import("@tanstack/vue-query").UseQueryReturnType; +export {}; diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.symbols b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.symbols new file mode 100644 index 0000000000000..7bdc3450c2fc8 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.symbols @@ -0,0 +1,657 @@ +//// [tests/cases/compiler/declarationEmitUsingAlternativeContainingModules2.ts] //// + +=== node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts === +type QueryKey = ReadonlyArray; +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 3 more) + +interface Register {} +>Register : Symbol(Register, Decl(useQuery-CPqkvEsh.d.ts, 0, 39)) + +type DefaultError = Register extends { +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) +>Register : Symbol(Register, Decl(useQuery-CPqkvEsh.d.ts, 0, 39)) + + defaultError: infer TError; +>defaultError : Symbol(defaultError, Decl(useQuery-CPqkvEsh.d.ts, 4, 38)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 5, 21)) +} + ? TError +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 5, 21)) + + : Error; +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) + +type ShouldRetryFunction = ( +>ShouldRetryFunction : Symbol(ShouldRetryFunction, Decl(useQuery-CPqkvEsh.d.ts, 8, 10)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 10, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + failureCount: number, +>failureCount : Symbol(failureCount, Decl(useQuery-CPqkvEsh.d.ts, 10, 51)) + + error: TError, +>error : Symbol(error, Decl(useQuery-CPqkvEsh.d.ts, 11, 23)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 10, 25)) + +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; +>RetryValue : Symbol(RetryValue, Decl(useQuery-CPqkvEsh.d.ts, 13, 13)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 14, 16)) +>ShouldRetryFunction : Symbol(ShouldRetryFunction, Decl(useQuery-CPqkvEsh.d.ts, 8, 10)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 14, 16)) + +type QueryFunctionContext< +>QueryFunctionContext : Symbol(QueryFunctionContext, Decl(useQuery-CPqkvEsh.d.ts, 14, 73)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 16, 26)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 17, 40)) + +> = [TPageParam] extends [never] +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 17, 40)) + + ? { + queryKey: TQueryKey; +>queryKey : Symbol(queryKey, Decl(useQuery-CPqkvEsh.d.ts, 20, 5)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 16, 26)) + } + : { + queryKey: TQueryKey; +>queryKey : Symbol(queryKey, Decl(useQuery-CPqkvEsh.d.ts, 23, 5)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 16, 26)) + + pageParam: TPageParam; +>pageParam : Symbol(pageParam, Decl(useQuery-CPqkvEsh.d.ts, 24, 26)) +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 17, 40)) + + }; + +type QueryFunction< +>QueryFunction : Symbol(QueryFunction, Decl(useQuery-CPqkvEsh.d.ts, 26, 6)) + + T = unknown, +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 28, 19)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 29, 14)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 30, 40)) + +> = (context: QueryFunctionContext) => T | Promise; +>context : Symbol(context, Decl(useQuery-CPqkvEsh.d.ts, 32, 5)) +>QueryFunctionContext : Symbol(QueryFunctionContext, Decl(useQuery-CPqkvEsh.d.ts, 14, 73)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 29, 14)) +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 30, 40)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 28, 19)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 28, 19)) + +interface QueryOptions< +>QueryOptions : Symbol(QueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 32, 77)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 34, 23)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 35, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 36, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 34, 23)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 37, 23)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 38, 40)) + +> { + retry?: RetryValue; +>retry : Symbol(QueryOptions.retry, Decl(useQuery-CPqkvEsh.d.ts, 40, 3)) +>RetryValue : Symbol(RetryValue, Decl(useQuery-CPqkvEsh.d.ts, 13, 13)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 35, 25)) + + queryFn?: QueryFunction; +>queryFn : Symbol(QueryOptions.queryFn, Decl(useQuery-CPqkvEsh.d.ts, 41, 29)) +>QueryFunction : Symbol(QueryFunction, Decl(useQuery-CPqkvEsh.d.ts, 26, 6)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 34, 23)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 37, 23)) +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 38, 40)) + + queryKey?: TQueryKey; +>queryKey : Symbol(QueryOptions.queryKey, Decl(useQuery-CPqkvEsh.d.ts, 42, 63)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 37, 23)) + + initialData?: TData; +>initialData : Symbol(QueryOptions.initialData, Decl(useQuery-CPqkvEsh.d.ts, 43, 23)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 36, 24)) + + initialDataUpdatedAt?: number | (() => number | undefined); +>initialDataUpdatedAt : Symbol(QueryOptions.initialDataUpdatedAt, Decl(useQuery-CPqkvEsh.d.ts, 44, 22)) +} + +interface QueryObserverOptions< +>QueryObserverOptions : Symbol(QueryObserverOptions, Decl(useQuery-CPqkvEsh.d.ts, 46, 1)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 49, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 50, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TQueryData = TQueryFnData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 51, 23)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 52, 28)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + + TPageParam = never, +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 53, 40)) + +> extends QueryOptions< +>QueryOptions : Symbol(QueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 32, 77)) + + TQueryFnData, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 48, 31)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 49, 25)) + + TQueryData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 51, 23)) + + TQueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 52, 28)) + + TPageParam +>TPageParam : Symbol(TPageParam, Decl(useQuery-CPqkvEsh.d.ts, 53, 40)) + + > { + enabled?: boolean; +>enabled : Symbol(QueryObserverOptions.enabled, Decl(useQuery-CPqkvEsh.d.ts, 61, 5)) + + refetchInterval?: number; +>refetchInterval : Symbol(QueryObserverOptions.refetchInterval, Decl(useQuery-CPqkvEsh.d.ts, 62, 20)) + + select?: (data: TQueryData) => TData; +>select : Symbol(QueryObserverOptions.select, Decl(useQuery-CPqkvEsh.d.ts, 63, 27)) +>data : Symbol(data, Decl(useQuery-CPqkvEsh.d.ts, 64, 12)) +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 51, 23)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 50, 24)) +} + +type UseQueryOptions< +>UseQueryOptions : Symbol(UseQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 65, 1)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 68, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 69, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TQueryData = TQueryFnData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 70, 23)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 71, 28)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + +> = { + [Property in keyof QueryObserverOptions< +>Property : Symbol(Property, Decl(useQuery-CPqkvEsh.d.ts, 74, 3)) +>QueryObserverOptions : Symbol(QueryObserverOptions, Decl(useQuery-CPqkvEsh.d.ts, 46, 1)) + + TQueryFnData, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 68, 25)) + + TData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 69, 24)) + + TQueryData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 70, 23)) + + TQueryKey +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 71, 28)) + + >]: QueryObserverOptions< +>QueryObserverOptions : Symbol(QueryObserverOptions, Decl(useQuery-CPqkvEsh.d.ts, 46, 1)) + + TQueryFnData, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 67, 21)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 68, 25)) + + TData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 69, 24)) + + TQueryData, +>TQueryData : Symbol(TQueryData, Decl(useQuery-CPqkvEsh.d.ts, 70, 23)) + + TQueryKey +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 71, 28)) + + >[Property]; +>Property : Symbol(Property, Decl(useQuery-CPqkvEsh.d.ts, 74, 3)) + +}; + +type UndefinedInitialQueryOptions< +>UndefinedInitialQueryOptions : Symbol(UndefinedInitialQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 87, 2)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 90, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 91, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 92, 23)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + +> = UseQueryOptions & { +>UseQueryOptions : Symbol(UseQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 65, 1)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 90, 25)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 91, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 89, 34)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 92, 23)) + + initialData?: undefined; +>initialData : Symbol(initialData, Decl(useQuery-CPqkvEsh.d.ts, 94, 77)) + +}; + +interface QueryObserverBaseResult { +>QueryObserverBaseResult : Symbol(QueryObserverBaseResult, Decl(useQuery-CPqkvEsh.d.ts, 96, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 98, 34)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 98, 50)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + data: TData | undefined; +>data : Symbol(QueryObserverBaseResult.data, Decl(useQuery-CPqkvEsh.d.ts, 98, 75)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 98, 34)) + + dataUpdatedAt: number; +>dataUpdatedAt : Symbol(QueryObserverBaseResult.dataUpdatedAt, Decl(useQuery-CPqkvEsh.d.ts, 99, 26)) + + error: TError | null; +>error : Symbol(QueryObserverBaseResult.error, Decl(useQuery-CPqkvEsh.d.ts, 100, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 98, 50)) + + errorUpdatedAt: number; +>errorUpdatedAt : Symbol(QueryObserverBaseResult.errorUpdatedAt, Decl(useQuery-CPqkvEsh.d.ts, 101, 23)) + + failureCount: number; +>failureCount : Symbol(QueryObserverBaseResult.failureCount, Decl(useQuery-CPqkvEsh.d.ts, 102, 25)) + + failureReason: TError | null; +>failureReason : Symbol(QueryObserverBaseResult.failureReason, Decl(useQuery-CPqkvEsh.d.ts, 103, 23)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 98, 50)) + + errorUpdateCount: number; +>errorUpdateCount : Symbol(QueryObserverBaseResult.errorUpdateCount, Decl(useQuery-CPqkvEsh.d.ts, 104, 31)) + + isError: boolean; +>isError : Symbol(QueryObserverBaseResult.isError, Decl(useQuery-CPqkvEsh.d.ts, 105, 27)) + + isFetched: boolean; +>isFetched : Symbol(QueryObserverBaseResult.isFetched, Decl(useQuery-CPqkvEsh.d.ts, 106, 19)) + + isFetchedAfterMount: boolean; +>isFetchedAfterMount : Symbol(QueryObserverBaseResult.isFetchedAfterMount, Decl(useQuery-CPqkvEsh.d.ts, 107, 21)) + + isFetching: boolean; +>isFetching : Symbol(QueryObserverBaseResult.isFetching, Decl(useQuery-CPqkvEsh.d.ts, 108, 31)) + + isLoading: boolean; +>isLoading : Symbol(QueryObserverBaseResult.isLoading, Decl(useQuery-CPqkvEsh.d.ts, 109, 22)) + + isPending: boolean; +>isPending : Symbol(QueryObserverBaseResult.isPending, Decl(useQuery-CPqkvEsh.d.ts, 110, 21)) + + isLoadingError: boolean; +>isLoadingError : Symbol(QueryObserverBaseResult.isLoadingError, Decl(useQuery-CPqkvEsh.d.ts, 111, 21)) + + isInitialLoading: boolean; +>isInitialLoading : Symbol(QueryObserverBaseResult.isInitialLoading, Decl(useQuery-CPqkvEsh.d.ts, 112, 26)) + + isPaused: boolean; +>isPaused : Symbol(QueryObserverBaseResult.isPaused, Decl(useQuery-CPqkvEsh.d.ts, 113, 28)) + + isPlaceholderData: boolean; +>isPlaceholderData : Symbol(QueryObserverBaseResult.isPlaceholderData, Decl(useQuery-CPqkvEsh.d.ts, 114, 20)) + + isRefetchError: boolean; +>isRefetchError : Symbol(QueryObserverBaseResult.isRefetchError, Decl(useQuery-CPqkvEsh.d.ts, 115, 29)) + + isRefetching: boolean; +>isRefetching : Symbol(QueryObserverBaseResult.isRefetching, Decl(useQuery-CPqkvEsh.d.ts, 116, 26)) + + isStale: boolean; +>isStale : Symbol(QueryObserverBaseResult.isStale, Decl(useQuery-CPqkvEsh.d.ts, 117, 24)) + + isSuccess: boolean; +>isSuccess : Symbol(QueryObserverBaseResult.isSuccess, Decl(useQuery-CPqkvEsh.d.ts, 118, 19)) +} + +interface QueryObserverSuccessResult +>QueryObserverSuccessResult : Symbol(QueryObserverSuccessResult, Decl(useQuery-CPqkvEsh.d.ts, 120, 1)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 122, 37)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 122, 53)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + extends QueryObserverBaseResult { +>QueryObserverBaseResult : Symbol(QueryObserverBaseResult, Decl(useQuery-CPqkvEsh.d.ts, 96, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 122, 37)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 122, 53)) + + data: TData; +>data : Symbol(QueryObserverSuccessResult.data, Decl(useQuery-CPqkvEsh.d.ts, 123, 50)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 122, 37)) + + error: null; +>error : Symbol(QueryObserverSuccessResult.error, Decl(useQuery-CPqkvEsh.d.ts, 124, 14)) + + isError: false; +>isError : Symbol(QueryObserverSuccessResult.isError, Decl(useQuery-CPqkvEsh.d.ts, 125, 14)) + + isPending: false; +>isPending : Symbol(QueryObserverSuccessResult.isPending, Decl(useQuery-CPqkvEsh.d.ts, 126, 17)) + + isLoadingError: false; +>isLoadingError : Symbol(QueryObserverSuccessResult.isLoadingError, Decl(useQuery-CPqkvEsh.d.ts, 127, 19)) + + isRefetchError: false; +>isRefetchError : Symbol(QueryObserverSuccessResult.isRefetchError, Decl(useQuery-CPqkvEsh.d.ts, 128, 24)) + + isSuccess: true; +>isSuccess : Symbol(QueryObserverSuccessResult.isSuccess, Decl(useQuery-CPqkvEsh.d.ts, 129, 24)) + + status: "success"; +>status : Symbol(QueryObserverSuccessResult.status, Decl(useQuery-CPqkvEsh.d.ts, 130, 18)) +} + +type DefinedQueryObserverResult< +>DefinedQueryObserverResult : Symbol(DefinedQueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 132, 1)) + + TData = unknown, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 134, 32)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 135, 18)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + +> = QueryObserverSuccessResult; +>QueryObserverSuccessResult : Symbol(QueryObserverSuccessResult, Decl(useQuery-CPqkvEsh.d.ts, 120, 1)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 134, 32)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 135, 18)) + +type QueryObserverResult< +>QueryObserverResult : Symbol(QueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 137, 46)) + + TData = unknown, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 138, 25)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 139, 18)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + +> = DefinedQueryObserverResult; +>DefinedQueryObserverResult : Symbol(DefinedQueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 132, 1)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 138, 25)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 139, 18)) + +type ToRef = { +>ToRef : Symbol(ToRef, Decl(useQuery-CPqkvEsh.d.ts, 141, 46)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 143, 11)) + + value: T; +>value : Symbol(value, Decl(useQuery-CPqkvEsh.d.ts, 143, 17)) +>T : Symbol(T, Decl(useQuery-CPqkvEsh.d.ts, 143, 11)) + +}; + +type UseBaseQueryReturnType< +>UseBaseQueryReturnType : Symbol(UseBaseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 145, 2)) + + TData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 147, 28)) + + TError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 148, 8)) + + Result = QueryObserverResult, +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>QueryObserverResult : Symbol(QueryObserverResult, Decl(useQuery-CPqkvEsh.d.ts, 137, 46)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 147, 28)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 148, 8)) + +> = { + [K in keyof Result]: K extends +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) + + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) + + : ToRef[K]>; +>ToRef : Symbol(ToRef, Decl(useQuery-CPqkvEsh.d.ts, 141, 46)) +>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --)) +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) +>K : Symbol(K, Decl(useQuery-CPqkvEsh.d.ts, 152, 3)) + +} & { + suspense: () => Promise; +>suspense : Symbol(suspense, Decl(useQuery-CPqkvEsh.d.ts, 158, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>Result : Symbol(Result, Decl(useQuery-CPqkvEsh.d.ts, 149, 9)) + +}; + +type UseQueryReturnType = UseBaseQueryReturnType; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 160, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 162, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 162, 30)) +>UseBaseQueryReturnType : Symbol(UseBaseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 145, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 162, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 162, 30)) + +declare function useQuery< +>useQuery : Symbol(useQuery, Decl(useQuery-CPqkvEsh.d.ts, 162, 79)) + + TQueryFnData = unknown, +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 164, 26)) + + TError = DefaultError, +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 165, 25)) +>DefaultError : Symbol(DefaultError, Decl(useQuery-CPqkvEsh.d.ts, 2, 21)) + + TData = TQueryFnData, +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 166, 24)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 164, 26)) + + TQueryKey extends QueryKey = QueryKey, +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 167, 23)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) +>QueryKey : Symbol(QueryKey, Decl(useQuery-CPqkvEsh.d.ts, 0, 0)) + +>( + options: UndefinedInitialQueryOptions, +>options : Symbol(options, Decl(useQuery-CPqkvEsh.d.ts, 169, 2)) +>UndefinedInitialQueryOptions : Symbol(UndefinedInitialQueryOptions, Decl(useQuery-CPqkvEsh.d.ts, 87, 2)) +>TQueryFnData : Symbol(TQueryFnData, Decl(useQuery-CPqkvEsh.d.ts, 164, 26)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 165, 25)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 166, 24)) +>TQueryKey : Symbol(TQueryKey, Decl(useQuery-CPqkvEsh.d.ts, 167, 23)) + +): UseQueryReturnType; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 160, 2)) +>TData : Symbol(TData, Decl(useQuery-CPqkvEsh.d.ts, 166, 24)) +>TError : Symbol(TError, Decl(useQuery-CPqkvEsh.d.ts, 165, 25)) + +export { type UseQueryReturnType as b, useQuery as u }; +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(useQuery-CPqkvEsh.d.ts, 160, 2)) +>b : Symbol(b, Decl(useQuery-CPqkvEsh.d.ts, 173, 8)) +>useQuery : Symbol(useQuery, Decl(useQuery-CPqkvEsh.d.ts, 162, 79)) +>u : Symbol(u, Decl(useQuery-CPqkvEsh.d.ts, 173, 38)) + +=== node_modules/@tanstack/vue-query/build/modern/index.d.ts === +export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; +>b : Symbol(b, Decl(useQuery-CPqkvEsh.d.ts, 173, 8)) +>UseQueryReturnType : Symbol(UseQueryReturnType, Decl(index.d.ts, 0, 8)) +>u : Symbol(u, Decl(useQuery-CPqkvEsh.d.ts, 173, 38)) +>useQuery : Symbol(useQuery, Decl(index.d.ts, 0, 33)) + +=== src/index.mts === +import { useQuery } from '@tanstack/vue-query' +>useQuery : Symbol(useQuery, Decl(index.mts, 0, 8)) + +const baseUrl = 'https://api.publicapis.org/' +>baseUrl : Symbol(baseUrl, Decl(index.mts, 2, 5)) + +interface IEntry { +>IEntry : Symbol(IEntry, Decl(index.mts, 2, 45)) + + API: string +>API : Symbol(IEntry.API, Decl(index.mts, 4, 18)) + + Description: string +>Description : Symbol(IEntry.Description, Decl(index.mts, 5, 13)) + + Auth: string +>Auth : Symbol(IEntry.Auth, Decl(index.mts, 6, 21)) + + HTTPS: boolean +>HTTPS : Symbol(IEntry.HTTPS, Decl(index.mts, 7, 14)) + + Cors: string +>Cors : Symbol(IEntry.Cors, Decl(index.mts, 8, 16)) + + Link: string +>Link : Symbol(IEntry.Link, Decl(index.mts, 9, 14)) + + Category: string +>Category : Symbol(IEntry.Category, Decl(index.mts, 10, 14)) +} + +const testApi = { +>testApi : Symbol(testApi, Decl(index.mts, 14, 5)) + + getEntries: (): Promise => { +>getEntries : Symbol(getEntries, Decl(index.mts, 14, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>IEntry : Symbol(IEntry, Decl(index.mts, 2, 45)) + + return fetch(baseUrl + 'entries') +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --)) +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>fetch(baseUrl + 'entries') .then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --)) +>baseUrl : Symbol(baseUrl, Decl(index.mts, 2, 5)) + + .then((res) => res.json()) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>res : Symbol(res, Decl(index.mts, 17, 13)) +>res.json : Symbol(Body.json, Decl(lib.dom.d.ts, --, --)) +>res : Symbol(res, Decl(index.mts, 17, 13)) +>json : Symbol(Body.json, Decl(lib.dom.d.ts, --, --)) + + .then((data) => data.entries) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>data : Symbol(data, Decl(index.mts, 18, 13)) +>data : Symbol(data, Decl(index.mts, 18, 13)) + + .catch((err) => console.log(err)) +>catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --)) +>err : Symbol(err, Decl(index.mts, 19, 14)) +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>err : Symbol(err, Decl(index.mts, 19, 14)) + } +} + +const entryKeys = { +>entryKeys : Symbol(entryKeys, Decl(index.mts, 23, 5)) + + all: ['entries'] as const, +>all : Symbol(all, Decl(index.mts, 23, 19)) +>const : Symbol(const) + + list: () => [...entryKeys.all, 'list'] as const +>list : Symbol(list, Decl(index.mts, 24, 28)) +>entryKeys.all : Symbol(all, Decl(index.mts, 23, 19)) +>entryKeys : Symbol(entryKeys, Decl(index.mts, 23, 5)) +>all : Symbol(all, Decl(index.mts, 23, 19)) +>const : Symbol(const) +} + +export const useEntries = () => { +>useEntries : Symbol(useEntries, Decl(index.mts, 28, 12)) + + return useQuery({ +>useQuery : Symbol(useQuery, Decl(index.mts, 0, 8)) + + queryKey: entryKeys.list(), +>queryKey : Symbol(queryKey, Decl(index.mts, 29, 19)) +>entryKeys.list : Symbol(list, Decl(index.mts, 24, 28)) +>entryKeys : Symbol(entryKeys, Decl(index.mts, 23, 5)) +>list : Symbol(list, Decl(index.mts, 24, 28)) + + queryFn: testApi.getEntries, +>queryFn : Symbol(queryFn, Decl(index.mts, 30, 31)) +>testApi.getEntries : Symbol(getEntries, Decl(index.mts, 14, 17)) +>testApi : Symbol(testApi, Decl(index.mts, 14, 5)) +>getEntries : Symbol(getEntries, Decl(index.mts, 14, 17)) + + select: (data) => data.slice(0, 10) +>select : Symbol(select, Decl(index.mts, 31, 32)) +>data : Symbol(data, Decl(index.mts, 32, 13)) +>data.slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --)) +>data : Symbol(data, Decl(index.mts, 32, 13)) +>slice : Symbol(Array.slice, Decl(lib.es5.d.ts, --, --)) + + }) +} + diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types new file mode 100644 index 0000000000000..a0454cddfd856 --- /dev/null +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types @@ -0,0 +1,448 @@ +//// [tests/cases/compiler/declarationEmitUsingAlternativeContainingModules2.ts] //// + +=== node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts === +type QueryKey = ReadonlyArray; +>QueryKey : readonly unknown[] + +interface Register {} + +type DefaultError = Register extends { +>DefaultError : Error + + defaultError: infer TError; +>defaultError : TError +} + ? TError + : Error; + +type ShouldRetryFunction = ( +>ShouldRetryFunction : ShouldRetryFunction + + failureCount: number, +>failureCount : number + + error: TError, +>error : TError + +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; +>RetryValue : RetryValue + +type QueryFunctionContext< +>QueryFunctionContext : QueryFunctionContext + + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = [TPageParam] extends [never] + ? { + queryKey: TQueryKey; +>queryKey : TQueryKey + } + : { + queryKey: TQueryKey; +>queryKey : TQueryKey + + pageParam: TPageParam; +>pageParam : TPageParam + + }; + +type QueryFunction< +>QueryFunction : QueryFunction + + T = unknown, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = (context: QueryFunctionContext) => T | Promise; +>context : QueryFunctionContext + +interface QueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> { + retry?: RetryValue; +>retry : RetryValue | undefined + + queryFn?: QueryFunction; +>queryFn : QueryFunction | undefined + + queryKey?: TQueryKey; +>queryKey : TQueryKey | undefined + + initialData?: TData; +>initialData : TData | undefined + + initialDataUpdatedAt?: number | (() => number | undefined); +>initialDataUpdatedAt : number | (() => number | undefined) | undefined +} + +interface QueryObserverOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> extends QueryOptions< + TQueryFnData, + TError, + TQueryData, + TQueryKey, + TPageParam + > { + enabled?: boolean; +>enabled : boolean | undefined + + refetchInterval?: number; +>refetchInterval : number | undefined + + select?: (data: TQueryData) => TData; +>select : ((data: TQueryData) => TData) | undefined +>data : TQueryData +} + +type UseQueryOptions< +>UseQueryOptions : UseQueryOptions + + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = { + [Property in keyof QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >]: QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >[Property]; +}; + +type UndefinedInitialQueryOptions< +>UndefinedInitialQueryOptions : UndefinedInitialQueryOptions + + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions & { + initialData?: undefined; +>initialData : undefined + +}; + +interface QueryObserverBaseResult { + data: TData | undefined; +>data : TData | undefined + + dataUpdatedAt: number; +>dataUpdatedAt : number + + error: TError | null; +>error : TError | null + + errorUpdatedAt: number; +>errorUpdatedAt : number + + failureCount: number; +>failureCount : number + + failureReason: TError | null; +>failureReason : TError | null + + errorUpdateCount: number; +>errorUpdateCount : number + + isError: boolean; +>isError : boolean + + isFetched: boolean; +>isFetched : boolean + + isFetchedAfterMount: boolean; +>isFetchedAfterMount : boolean + + isFetching: boolean; +>isFetching : boolean + + isLoading: boolean; +>isLoading : boolean + + isPending: boolean; +>isPending : boolean + + isLoadingError: boolean; +>isLoadingError : boolean + + isInitialLoading: boolean; +>isInitialLoading : boolean + + isPaused: boolean; +>isPaused : boolean + + isPlaceholderData: boolean; +>isPlaceholderData : boolean + + isRefetchError: boolean; +>isRefetchError : boolean + + isRefetching: boolean; +>isRefetching : boolean + + isStale: boolean; +>isStale : boolean + + isSuccess: boolean; +>isSuccess : boolean +} + +interface QueryObserverSuccessResult + extends QueryObserverBaseResult { + data: TData; +>data : TData + + error: null; +>error : null + + isError: false; +>isError : false +>false : false + + isPending: false; +>isPending : false +>false : false + + isLoadingError: false; +>isLoadingError : false +>false : false + + isRefetchError: false; +>isRefetchError : false +>false : false + + isSuccess: true; +>isSuccess : true +>true : true + + status: "success"; +>status : "success" +} + +type DefinedQueryObserverResult< +>DefinedQueryObserverResult : DefinedQueryObserverResult + + TData = unknown, + TError = DefaultError, +> = QueryObserverSuccessResult; +type QueryObserverResult< +>QueryObserverResult : QueryObserverResult + + TData = unknown, + TError = DefaultError, +> = DefinedQueryObserverResult; + +type ToRef = { +>ToRef : ToRef + + value: T; +>value : T + +}; + +type UseBaseQueryReturnType< +>UseBaseQueryReturnType : UseBaseQueryReturnType + + TData, + TError, + Result = QueryObserverResult, +> = { + [K in keyof Result]: K extends + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] + : ToRef[K]>; +} & { + suspense: () => Promise; +>suspense : () => Promise + +}; + +type UseQueryReturnType = UseBaseQueryReturnType; +>UseQueryReturnType : UseQueryReturnType + +declare function useQuery< +>useQuery : (options: UndefinedInitialQueryOptions) => UseQueryReturnType + + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +>( + options: UndefinedInitialQueryOptions, +>options : UndefinedInitialQueryOptions + +): UseQueryReturnType; + +export { type UseQueryReturnType as b, useQuery as u }; +>UseQueryReturnType : any +>b : any +>useQuery : (options: UndefinedInitialQueryOptions) => UseQueryReturnType +>u : (options: UndefinedInitialQueryOptions) => UseQueryReturnType + +=== node_modules/@tanstack/vue-query/build/modern/index.d.ts === +export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; +>b : any +>UseQueryReturnType : any +>u : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b + +=== src/index.mts === +import { useQuery } from '@tanstack/vue-query' +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b + +const baseUrl = 'https://api.publicapis.org/' +>baseUrl : "https://api.publicapis.org/" +>'https://api.publicapis.org/' : "https://api.publicapis.org/" + +interface IEntry { + API: string +>API : string + + Description: string +>Description : string + + Auth: string +>Auth : string + + HTTPS: boolean +>HTTPS : boolean + + Cors: string +>Cors : string + + Link: string +>Link : string + + Category: string +>Category : string +} + +const testApi = { +>testApi : { getEntries: () => Promise; } +>{ getEntries: (): Promise => { return fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch((err) => console.log(err)) }} : { getEntries: () => Promise; } + + getEntries: (): Promise => { +>getEntries : () => Promise +>(): Promise => { return fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch((err) => console.log(err)) } : () => Promise + + return fetch(baseUrl + 'entries') +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch((err) => console.log(err)) : Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) .catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then((data) => data.entries) : Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) .then : (onfulfilled?: ((value: any) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>fetch(baseUrl + 'entries') .then((res) => res.json()) : Promise +>fetch(baseUrl + 'entries') .then : (onfulfilled?: ((value: Response) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>fetch(baseUrl + 'entries') : Promise +>fetch : (input: RequestInfo | URL, init?: RequestInit | undefined) => Promise +>baseUrl + 'entries' : string +>baseUrl : "https://api.publicapis.org/" +>'entries' : "entries" + + .then((res) => res.json()) +>then : (onfulfilled?: ((value: Response) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>(res) => res.json() : (res: Response) => Promise +>res : Response +>res.json() : Promise +>res.json : () => Promise +>res : Response +>json : () => Promise + + .then((data) => data.entries) +>then : (onfulfilled?: ((value: any) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>(data) => data.entries : (data: any) => any +>data : any +>data.entries : any +>data : any +>entries : any + + .catch((err) => console.log(err)) +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>(err) => console.log(err) : (err: any) => void +>err : any +>console.log(err) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>err : any + } +} + +const entryKeys = { +>entryKeys : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } +>{ all: ['entries'] as const, list: () => [...entryKeys.all, 'list'] as const} : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } + + all: ['entries'] as const, +>all : readonly ["entries"] +>['entries'] as const : readonly ["entries"] +>['entries'] : readonly ["entries"] +>'entries' : "entries" + + list: () => [...entryKeys.all, 'list'] as const +>list : () => readonly ["entries", "list"] +>() => [...entryKeys.all, 'list'] as const : () => readonly ["entries", "list"] +>[...entryKeys.all, 'list'] as const : readonly ["entries", "list"] +>[...entryKeys.all, 'list'] : readonly ["entries", "list"] +>...entryKeys.all : "entries" +>entryKeys.all : readonly ["entries"] +>entryKeys : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } +>all : readonly ["entries"] +>'list' : "list" +} + +export const useEntries = () => { +>useEntries : () => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +>() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b + + return useQuery({ +>useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +>{ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) } : { queryKey: readonly ["entries", "list"]; queryFn: () => Promise; select: (data: IEntry[]) => IEntry[]; } + + queryKey: entryKeys.list(), +>queryKey : readonly ["entries", "list"] +>entryKeys.list() : readonly ["entries", "list"] +>entryKeys.list : () => readonly ["entries", "list"] +>entryKeys : { all: readonly ["entries"]; list: () => readonly ["entries", "list"]; } +>list : () => readonly ["entries", "list"] + + queryFn: testApi.getEntries, +>queryFn : () => Promise +>testApi.getEntries : () => Promise +>testApi : { getEntries: () => Promise; } +>getEntries : () => Promise + + select: (data) => data.slice(0, 10) +>select : (data: IEntry[]) => IEntry[] +>(data) => data.slice(0, 10) : (data: IEntry[]) => IEntry[] +>data : IEntry[] +>data.slice(0, 10) : IEntry[] +>data.slice : (start?: number | undefined, end?: number | undefined) => IEntry[] +>data : IEntry[] +>slice : (start?: number | undefined, end?: number | undefined) => IEntry[] +>0 : 0 +>10 : 10 + + }) +} + diff --git a/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts b/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts new file mode 100644 index 0000000000000..e497819e07e38 --- /dev/null +++ b/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules1.ts @@ -0,0 +1,239 @@ +// @strict: true +// @declaration: true +// @module: nodenext +// @moduleResolution: nodenext +// @target: esnext + +// @filename: node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts +type QueryKey = ReadonlyArray; + +interface Register {} + +type DefaultError = Register extends { + defaultError: infer TError; +} + ? TError + : Error; + +type ShouldRetryFunction = ( + failureCount: number, + error: TError, +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; + +type QueryFunctionContext< + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = [TPageParam] extends [never] + ? { + queryKey: TQueryKey; + } + : { + queryKey: TQueryKey; + pageParam: TPageParam; + }; + +type QueryFunction< + T = unknown, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = (context: QueryFunctionContext) => T | Promise; + +interface QueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> { + retry?: RetryValue; + queryFn?: QueryFunction; + queryKey?: TQueryKey; + initialData?: TData; + initialDataUpdatedAt?: number | (() => number | undefined); +} + +interface QueryObserverOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> extends QueryOptions< + TQueryFnData, + TError, + TQueryData, + TQueryKey, + TPageParam + > { + enabled?: boolean; + refetchInterval?: number; + select?: (data: TQueryData) => TData; +} + +type UseQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = { + [Property in keyof QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >]: QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >[Property]; +}; + +type UndefinedInitialQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions & { + initialData?: undefined; +}; + +interface QueryObserverBaseResult { + data: TData | undefined; + dataUpdatedAt: number; + error: TError | null; + errorUpdatedAt: number; + failureCount: number; + failureReason: TError | null; + errorUpdateCount: number; + isError: boolean; + isFetched: boolean; + isFetchedAfterMount: boolean; + isFetching: boolean; + isLoading: boolean; + isPending: boolean; + isLoadingError: boolean; + isInitialLoading: boolean; + isPaused: boolean; + isPlaceholderData: boolean; + isRefetchError: boolean; + isRefetching: boolean; + isStale: boolean; + isSuccess: boolean; +} + +interface QueryObserverSuccessResult + extends QueryObserverBaseResult { + data: TData; + error: null; + isError: false; + isPending: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + status: "success"; +} + +type DefinedQueryObserverResult< + TData = unknown, + TError = DefaultError, +> = QueryObserverSuccessResult; +type QueryObserverResult< + TData = unknown, + TError = DefaultError, +> = DefinedQueryObserverResult; + +type ToRef = { + value: T; +}; + +type UseBaseQueryReturnType< + TData, + TError, + Result = QueryObserverResult, +> = { + [K in keyof Result]: K extends + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] + : ToRef[K]>; +} & { + suspense: () => Promise; +}; + +type UseQueryReturnType = UseBaseQueryReturnType; + +declare function useQuery< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +>( + options: UndefinedInitialQueryOptions, +): UseQueryReturnType; + +export { type UseQueryReturnType, useQuery }; + +// @filename: node_modules/@tanstack/vue-query/build/modern/index.d.ts +export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; + +// @filename: node_modules/@tanstack/vue-query/package.json +{ + "name": "@tanstack/vue-query", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./build/modern/index.d.ts", + "default": "./build/modern/index.js" + }, + "require": { + "types": "./build/modern/index.d.cts", + "default": "./build/modern/index.cjs" + } + } + } +} + +// @filename: src/index.mts +import { useQuery } from '@tanstack/vue-query' + +const baseUrl = 'https://api.publicapis.org/' + +interface IEntry { + API: string + Description: string + Auth: string + HTTPS: boolean + Cors: string + Link: string + Category: string +} + +const testApi = { + getEntries: (): Promise => { + return fetch(baseUrl + 'entries') + .then((res) => res.json()) + .then((data) => data.entries) + .catch((err) => console.log(err)) + } +} + +const entryKeys = { + all: ['entries'] as const, + list: () => [...entryKeys.all, 'list'] as const +} + +export const useEntries = () => { + return useQuery({ + queryKey: entryKeys.list(), + queryFn: testApi.getEntries, + select: (data) => data.slice(0, 10) + }) +} diff --git a/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules2.ts b/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules2.ts new file mode 100644 index 0000000000000..7d29e551f5157 --- /dev/null +++ b/tests/cases/compiler/declarationEmitUsingAlternativeContainingModules2.ts @@ -0,0 +1,239 @@ +// @strict: true +// @declaration: true +// @module: nodenext +// @moduleResolution: nodenext +// @target: esnext + +// @filename: node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts +type QueryKey = ReadonlyArray; + +interface Register {} + +type DefaultError = Register extends { + defaultError: infer TError; +} + ? TError + : Error; + +type ShouldRetryFunction = ( + failureCount: number, + error: TError, +) => boolean; +type RetryValue = boolean | number | ShouldRetryFunction; + +type QueryFunctionContext< + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = [TPageParam] extends [never] + ? { + queryKey: TQueryKey; + } + : { + queryKey: TQueryKey; + pageParam: TPageParam; + }; + +type QueryFunction< + T = unknown, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> = (context: QueryFunctionContext) => T | Promise; + +interface QueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> { + retry?: RetryValue; + queryFn?: QueryFunction; + queryKey?: TQueryKey; + initialData?: TData; + initialDataUpdatedAt?: number | (() => number | undefined); +} + +interface QueryObserverOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + TPageParam = never, +> extends QueryOptions< + TQueryFnData, + TError, + TQueryData, + TQueryKey, + TPageParam + > { + enabled?: boolean; + refetchInterval?: number; + select?: (data: TQueryData) => TData; +} + +type UseQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = { + [Property in keyof QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >]: QueryObserverOptions< + TQueryFnData, + TError, + TData, + TQueryData, + TQueryKey + >[Property]; +}; + +type UndefinedInitialQueryOptions< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions & { + initialData?: undefined; +}; + +interface QueryObserverBaseResult { + data: TData | undefined; + dataUpdatedAt: number; + error: TError | null; + errorUpdatedAt: number; + failureCount: number; + failureReason: TError | null; + errorUpdateCount: number; + isError: boolean; + isFetched: boolean; + isFetchedAfterMount: boolean; + isFetching: boolean; + isLoading: boolean; + isPending: boolean; + isLoadingError: boolean; + isInitialLoading: boolean; + isPaused: boolean; + isPlaceholderData: boolean; + isRefetchError: boolean; + isRefetching: boolean; + isStale: boolean; + isSuccess: boolean; +} + +interface QueryObserverSuccessResult + extends QueryObserverBaseResult { + data: TData; + error: null; + isError: false; + isPending: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + status: "success"; +} + +type DefinedQueryObserverResult< + TData = unknown, + TError = DefaultError, +> = QueryObserverSuccessResult; +type QueryObserverResult< + TData = unknown, + TError = DefaultError, +> = DefinedQueryObserverResult; + +type ToRef = { + value: T; +}; + +type UseBaseQueryReturnType< + TData, + TError, + Result = QueryObserverResult, +> = { + [K in keyof Result]: K extends + | "fetchNextPage" + | "fetchPreviousPage" + | "refetch" + ? Result[K] + : ToRef[K]>; +} & { + suspense: () => Promise; +}; + +type UseQueryReturnType = UseBaseQueryReturnType; + +declare function useQuery< + TQueryFnData = unknown, + TError = DefaultError, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +>( + options: UndefinedInitialQueryOptions, +): UseQueryReturnType; + +export { type UseQueryReturnType as b, useQuery as u }; + +// @filename: node_modules/@tanstack/vue-query/build/modern/index.d.ts +export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; + +// @filename: node_modules/@tanstack/vue-query/package.json +{ + "name": "@tanstack/vue-query", + "type": "module", + "exports": { + ".": { + "import": { + "types": "./build/modern/index.d.ts", + "default": "./build/modern/index.js" + }, + "require": { + "types": "./build/modern/index.d.cts", + "default": "./build/modern/index.cjs" + } + } + } +} + +// @filename: src/index.mts +import { useQuery } from '@tanstack/vue-query' + +const baseUrl = 'https://api.publicapis.org/' + +interface IEntry { + API: string + Description: string + Auth: string + HTTPS: boolean + Cors: string + Link: string + Category: string +} + +const testApi = { + getEntries: (): Promise => { + return fetch(baseUrl + 'entries') + .then((res) => res.json()) + .then((data) => data.entries) + .catch((err) => console.log(err)) + } +} + +const entryKeys = { + all: ['entries'] as const, + list: () => [...entryKeys.all, 'list'] as const +} + +export const useEntries = () => { + return useQuery({ + queryKey: entryKeys.list(), + queryFn: testApi.getEntries, + select: (data) => data.slice(0, 10) + }) +}