Title: Declarations can't be emitted when types from inner modules are exported through separate export declarations · Issue #56856 · microsoft/TypeScript · GitHub
Open Graph Title: Declarations can't be emitted when types from inner modules are exported through separate export declarations · Issue #56856 · microsoft/TypeScript
X Title: Declarations can't be emitted when types from inner modules are exported through separate export declarations · Issue #56856 · microsoft/TypeScript
Description: 🔎 Search Terms declarations portable emit modules export declaration alias aliasing 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link N/A 💻 Code // @strict: true // @declaration: true // @...
Open Graph Description: 🔎 Search Terms declarations portable emit modules export declaration alias aliasing 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link N/A 💻 Code // ...
X Description: 🔎 Search Terms declarations portable emit modules export declaration alias aliasing 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link N/A 💻 Code...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/56856
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Declarations can't be emitted when types from inner modules are exported through separate export declarations","articleBody":"### 🔎 Search Terms\n\ndeclarations portable emit modules export declaration alias aliasing\n\n### 🕗 Version & Regression Information\n\n- This is the behavior in every version I tried\n\n### ⏯ Playground Link\n\nN/A\n\n### 💻 Code\n\n```ts\r\n// @strict: true\r\n// @declaration: true\r\n// @module: nodenext\r\n// @moduleResolution: nodenext\r\n// @target: esnext\r\n\r\n// @filename: node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts\r\ntype QueryKey = ReadonlyArray\u003cunknown>;\r\n\r\ninterface Register {}\r\n\r\ntype DefaultError = Register extends {\r\n defaultError: infer TError;\r\n}\r\n ? TError\r\n : Error;\r\n\r\ntype ShouldRetryFunction\u003cTError = DefaultError> = (\r\n failureCount: number,\r\n error: TError,\r\n) => boolean;\r\ntype RetryValue\u003cTError> = boolean | number | ShouldRetryFunction\u003cTError>;\r\n\r\ntype QueryFunctionContext\u003c\r\n TQueryKey extends QueryKey = QueryKey,\r\n TPageParam = never,\r\n> = [TPageParam] extends [never]\r\n ? {\r\n queryKey: TQueryKey;\r\n }\r\n : {\r\n queryKey: TQueryKey;\r\n pageParam: TPageParam;\r\n };\r\n\r\ntype QueryFunction\u003c\r\n T = unknown,\r\n TQueryKey extends QueryKey = QueryKey,\r\n TPageParam = never,\r\n> = (context: QueryFunctionContext\u003cTQueryKey, TPageParam>) => T | Promise\u003cT>;\r\n\r\ninterface QueryOptions\u003c\r\n TQueryFnData = unknown,\r\n TError = DefaultError,\r\n TData = TQueryFnData,\r\n TQueryKey extends QueryKey = QueryKey,\r\n TPageParam = never,\r\n> {\r\n retry?: RetryValue\u003cTError>;\r\n queryFn?: QueryFunction\u003cTQueryFnData, TQueryKey, TPageParam>;\r\n queryKey?: TQueryKey;\r\n initialData?: TData;\r\n initialDataUpdatedAt?: number | (() => number | undefined);\r\n}\r\n\r\ninterface QueryObserverOptions\u003c\r\n TQueryFnData = unknown,\r\n TError = DefaultError,\r\n TData = TQueryFnData,\r\n TQueryData = TQueryFnData,\r\n TQueryKey extends QueryKey = QueryKey,\r\n TPageParam = never,\r\n> extends QueryOptions\u003c\r\n TQueryFnData,\r\n TError,\r\n TQueryData,\r\n TQueryKey,\r\n TPageParam\r\n > {\r\n enabled?: boolean;\r\n refetchInterval?: number;\r\n select?: (data: TQueryData) => TData;\r\n}\r\n\r\ntype UseQueryOptions\u003c\r\n TQueryFnData = unknown,\r\n TError = DefaultError,\r\n TData = TQueryFnData,\r\n TQueryData = TQueryFnData,\r\n TQueryKey extends QueryKey = QueryKey,\r\n> = {\r\n [Property in keyof QueryObserverOptions\u003c\r\n TQueryFnData,\r\n TError,\r\n TData,\r\n TQueryData,\r\n TQueryKey\r\n >]: QueryObserverOptions\u003c\r\n TQueryFnData,\r\n TError,\r\n TData,\r\n TQueryData,\r\n TQueryKey\r\n >[Property];\r\n};\r\n\r\ntype UndefinedInitialQueryOptions\u003c\r\n TQueryFnData = unknown,\r\n TError = DefaultError,\r\n TData = TQueryFnData,\r\n TQueryKey extends QueryKey = QueryKey,\r\n> = UseQueryOptions\u003cTQueryFnData, TError, TData, TQueryFnData, TQueryKey> & {\r\n initialData?: undefined;\r\n};\r\n\r\ninterface QueryObserverBaseResult\u003cTData = unknown, TError = DefaultError> {\r\n data: TData | undefined;\r\n dataUpdatedAt: number;\r\n error: TError | null;\r\n errorUpdatedAt: number;\r\n failureCount: number;\r\n failureReason: TError | null;\r\n errorUpdateCount: number;\r\n isError: boolean;\r\n isFetched: boolean;\r\n isFetchedAfterMount: boolean;\r\n isFetching: boolean;\r\n isLoading: boolean;\r\n isPending: boolean;\r\n isLoadingError: boolean;\r\n isInitialLoading: boolean;\r\n isPaused: boolean;\r\n isPlaceholderData: boolean;\r\n isRefetchError: boolean;\r\n isRefetching: boolean;\r\n isStale: boolean;\r\n isSuccess: boolean;\r\n}\r\n\r\ninterface QueryObserverSuccessResult\u003cTData = unknown, TError = DefaultError>\r\n extends QueryObserverBaseResult\u003cTData, TError> {\r\n data: TData;\r\n error: null;\r\n isError: false;\r\n isPending: false;\r\n isLoadingError: false;\r\n isRefetchError: false;\r\n isSuccess: true;\r\n status: \"success\";\r\n}\r\n\r\ntype DefinedQueryObserverResult\u003c\r\n TData = unknown,\r\n TError = DefaultError,\r\n> = QueryObserverSuccessResult\u003cTData, TError>;\r\ntype QueryObserverResult\u003c\r\n TData = unknown,\r\n TError = DefaultError,\r\n> = DefinedQueryObserverResult\u003cTData, TError>;\r\n\r\ntype ToRef\u003cT> = {\r\n value: T;\r\n};\r\n\r\ntype UseBaseQueryReturnType\u003c\r\n TData,\r\n TError,\r\n Result = QueryObserverResult\u003cTData, TError>,\r\n> = {\r\n [K in keyof Result]: K extends\r\n | \"fetchNextPage\"\r\n | \"fetchPreviousPage\"\r\n | \"refetch\"\r\n ? Result[K]\r\n : ToRef\u003cReadonly\u003cResult>[K]>;\r\n} & {\r\n suspense: () => Promise\u003cResult>;\r\n};\r\n\r\ntype UseQueryReturnType\u003cTData, TError> = UseBaseQueryReturnType\u003cTData, TError>;\r\n\r\ndeclare function useQuery\u003c\r\n TQueryFnData = unknown,\r\n TError = DefaultError,\r\n TData = TQueryFnData,\r\n TQueryKey extends QueryKey = QueryKey,\r\n>(\r\n options: UndefinedInitialQueryOptions\u003cTQueryFnData, TError, TData, TQueryKey>,\r\n): UseQueryReturnType\u003cTData, TError>;\r\n\r\nexport { type UseQueryReturnType as b, useQuery as u };\r\n\r\n// @filename: node_modules/@tanstack/vue-query/build/modern/index.d.ts\r\nexport { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js';\r\n\r\n// @filename: node_modules/@tanstack/vue-query/package.json\r\n{\r\n \"name\": \"@tanstack/vue-query\",\r\n \"type\": \"module\",\r\n \"exports\": {\r\n \".\": {\r\n \"import\": {\r\n \"types\": \"./build/modern/index.d.ts\",\r\n \"default\": \"./build/modern/index.js\"\r\n },\r\n \"require\": {\r\n \"types\": \"./build/modern/index.d.cts\",\r\n \"default\": \"./build/modern/index.cjs\"\r\n }\r\n }\r\n }\r\n}\r\n\r\n// @filename: src/index.mts\r\nimport { useQuery } from '@tanstack/vue-query'\r\n\r\nconst baseUrl = 'https://api.publicapis.org/'\r\n\r\ninterface IEntry {\r\n API: string\r\n Description: string\r\n Auth: string\r\n HTTPS: boolean\r\n Cors: string\r\n Link: string\r\n Category: string\r\n}\r\n\r\nconst testApi = {\r\n getEntries: (): Promise\u003cIEntry[]> => {\r\n return fetch(baseUrl + 'entries')\r\n .then((res) => res.json())\r\n .then((data) => data.entries)\r\n .catch((err) => console.log(err))\r\n }\r\n}\r\n\r\nconst entryKeys = {\r\n all: ['entries'] as const,\r\n list: () => [...entryKeys.all, 'list'] as const\r\n}\r\n\r\nexport const useEntries = () => {\r\n return useQuery({\r\n queryKey: entryKeys.list(),\r\n queryFn: testApi.getEntries,\r\n select: (data) => data.slice(0, 10)\r\n })\r\n}\r\n```\r\n\n\n### 🙁 Actual behavior\n\n```\r\nThe inferred type of 'useEntries' cannot be named without a reference to '../../node_modules/@tanstack/vue-query/build/modern/useQuery-d58edace'. This is likely not portable. A type annotation is necessary.ts(2742)\r\n```\n\n### 🙂 Expected behavior\n\nA declaration like this should be emitted successfully:\r\n```ts\r\ninterface IEntry {\r\n API: string;\r\n Description: string;\r\n Auth: string;\r\n HTTPS: boolean;\r\n Cors: string;\r\n Link: string;\r\n Category: string;\r\n}\r\nexport declare const useEntries: () => import(\"@tanstack/vue-query\").UseQueryReturnType\u003cIEntry[], Error>;\r\nexport {};\r\n```\n\n### Additional information about the issue\n\nIt originally has been reported here: https://github.com/TanStack/query/issues/6318","author":{"url":"https://github.com/Andarist","@type":"Person","name":"Andarist"},"datePublished":"2023-12-23T11:47:53Z","url":"https://github.com/microsoft/TypeScript/issues/56856"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0c0222ca-f8b8-f28f-8343-15ad4c3177f7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AA54:292BF3:E8F6B5:12F08B2:6B04E888 |
| html-safe-nonce | 4f298cb0b8e3eecbe5d91180a56c137ff0ec0b3c8153d092f209c203287e550b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTU0OjI5MkJGMzpFOEY2QjU6MTJGMDhCMjo2QjA0RTg4OCIsInZpc2l0b3JfaWQiOiIyMzY2NTAyMjY0MzU0Njk1MzA0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8520a8cac33012bdc454bd3b88925ef7280d4181240e03097207e060f82d0cd7 |
| hovercard-subject-tag | issue:2054763867 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/56856/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f964cf0536378048c616dcc5b556c4446bac8821fda4c8e590957cc0d7489ae3/microsoft/TypeScript/issues/56856 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f964cf0536378048c616dcc5b556c4446bac8821fda4c8e590957cc0d7489ae3/microsoft/TypeScript/issues/56856 |
| og:image:alt | 🔎 Search Terms declarations portable emit modules export declaration alias aliasing 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link N/A 💻 Code // ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Andarist |
| hostname | github.com |
| expected-hostname | github.com |
| None | f3851aad500d8e8dce736722ddc6fa9596e17d9fce3c53581eba968664c0bc32 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e29c922455fd8137f27e1cfcdf6a1e8b920b1926 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width