Title: 'Circular definition of import alias' error in 5.4.0-Beta · Issue #57357 · microsoft/TypeScript · GitHub
Open Graph Title: 'Circular definition of import alias' error in 5.4.0-Beta · Issue #57357 · microsoft/TypeScript
X Title: 'Circular definition of import alias' error in 5.4.0-Beta · Issue #57357 · microsoft/TypeScript
Description: 🔎 Search Terms circular definition binding inference 🕗 Version & Regression Information This changed between versions 5.3.3 and 5.4.0-beta (5.4.0-dev.20240110 and 5.4.0-dev.20240111) This changed in PR #56087 ⏯ Playground Link https://ww...
Open Graph Description: 🔎 Search Terms circular definition binding inference 🕗 Version & Regression Information This changed between versions 5.3.3 and 5.4.0-beta (5.4.0-dev.20240110 and 5.4.0-dev.20240111) This changed i...
X Description: 🔎 Search Terms circular definition binding inference 🕗 Version & Regression Information This changed between versions 5.3.3 and 5.4.0-beta (5.4.0-dev.20240110 and 5.4.0-dev.20240111) This chang...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/57357
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"'Circular definition of import alias' error in 5.4.0-Beta","articleBody":"### 🔎 Search Terms\r\n\r\ncircular definition binding inference\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This changed between versions 5.3.3 and 5.4.0-beta (5.4.0-dev.20240110 and 5.4.0-dev.20240111)\r\n- This changed in PR #56087\r\n\r\n### ⏯ Playground Link\r\n\r\nhttps://www.typescriptlang.org/dev/bug-workbench/?ts=5.4.0-beta#code/PTAEAEDMEsBsFMB2BDAtvAXKAJsgLsgHR4DOAUNKgA4D2ATnqHgJ5XygDeoAIvsqAF9QkOjVSgA5IWBVRAY3gkS9CQG4yIUJVoMmrdhyEixoAETSWbU6tCaAPAFoHoAK6IHcsekSNkibKDwdKJ0oADmNIqgyADuyMxkZPAAHjqMkG5yeNA0iOHweLwEABQAlJxkoFW2YOCkDilsWQ3B9JXVdAUudHmeiCR4dC5ZRcjFhuUk+NAkMFEA2gC66gKJGYhZOb25A0MjfMW4BFij5RztVX0DnKCEd7I0VCSCoAC8OHzq1TWgnXjdeSOyBs31B1XsTlc7k8qG8vn8gVaoQiUVi8Quvy6PQqYKqd0IDyeABoMQIVolNFA4Eg0Jg9GxiORGvRGJZ2AA1ZCwFzsd6GCm1GAIFDoLAPBRKeiMijUFk3MIFUYvYziKTAIFqRLaOVsnHVTnc+AkoyiVUWfSapKpHX6Hh8N56qoARxcfmyLCwBp5K3UZGw8DksGQnWEmWyuVAck6+HgACV4C7FHgAAryRTKOh2eNOgB8xQxVGgbFg0EQdLKbxzoGzJNKWGzvuZuiujHF6foDqj8Bj2Z5A1TNAlGfz3wVhT4ZFKvspQppotAqGQpel2t0XDbktCJpMao3Gc1TcY-sgyBcsFbac308F1JFdJi9AA1kFS3ggieFCvZbpdQBlIIAG5BMIpqSNIi6lpah70uwAD6AAqDrFGyNCQKA-50EBdBTmQQA\r\n\r\n### 💻 Code\r\n\r\n(reduced down from a large project as best I could)\r\n\r\n```ts repro\r\n// @filename: data.ts\r\nimport type { Data } from './processor';\r\n// import type {} from \"./type\"; // \u003c-- un-comment and error goes away\r\n\r\nexport function getData() {\r\n // @ts-expect-error\r\n return constructData({}) satisfies [];\r\n}\r\n\r\nfunction constructData(data: Data) {\r\n const { ...props } = data;\r\n // return data; // \u003c-- un-comment and error goes away\r\n return {\r\n ...props,\r\n };\r\n}\r\n\r\n// @filename: type.ts\r\nexport type Value = {}\r\n\r\n// @filename: processor.ts\r\nimport { getData } from './data';\r\n\r\nimport type {\r\n Value,\r\n} from './type';\r\n\r\nexport type Data = {\r\n quantity: Value;\r\n};\r\n\r\ndeclare function createRequestProcessor\u003cReq>(\r\n pipeline: () => Req,\r\n): Req;\r\n\r\nexport const processor = createRequestProcessor(\r\n getData\r\n);\r\n\r\n// @filename: main.ts\r\nimport { processor } from './processor';\r\nexport default processor;\r\n\r\n// @filename: workerinterface.ts\r\nimport type Server from './main';\r\n\r\nexport type _T = (typeof Server);\r\n```\r\n\r\n\r\n### 🙁 Actual behavior\r\n\r\nErrors about circular types\r\n\r\n> implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.\r\n\r\n### 🙂 Expected behavior\r\n\r\nEither no error, or a clearer error message. The types don't appear to be circular.\r\n\r\n### Additional information about the issue\r\n\r\nThe code that is now erroring was already using `// @ts-expect-error` to ignore an error. Fixing that hidden error avoids this issue.\r\n\r\nAdding an unused import (as commented in the same) also fixes the error. So it seems that TypeScript has gotten into an odd state.","author":{"url":"https://github.com/acutmore","@type":"Person","name":"acutmore"},"datePublished":"2024-02-09T21:10:48Z","url":"https://github.com/microsoft/TypeScript/issues/57357"}
| 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:e5ca97f9-84f7-4cc2-da27-b9867a6e40f1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D3DA:6DC60:26FFAF:30D431:6B00FF31 |
| html-safe-nonce | 4e709556bd2824a25f8a747dcb9b7d1d215fd0b87f763c6cb93254929113febf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEM0RBOjZEQzYwOjI2RkZBRjozMEQ0MzE6NkIwMEZGMzEiLCJ2aXNpdG9yX2lkIjoiNzY3MDkzNzk5MzMzODc0ODcyMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 86d72c8fa7a49f5afb4621fa2e7169a23fcc14d3303efdc99d716815d58f53d8 |
| hovercard-subject-tag | issue:2127851499 |
| 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/57357/issue_layout |
| twitter:image | https://opengraph.githubassets.com/85d8fe53d474348934565e0406191affa2e760c4fa3b4edda3f24c1f69c39086/microsoft/TypeScript/issues/57357 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/85d8fe53d474348934565e0406191affa2e760c4fa3b4edda3f24c1f69c39086/microsoft/TypeScript/issues/57357 |
| og:image:alt | 🔎 Search Terms circular definition binding inference 🕗 Version & Regression Information This changed between versions 5.3.3 and 5.4.0-beta (5.4.0-dev.20240110 and 5.4.0-dev.20240111) This changed i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | acutmore |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width