Title: Recursive type constraint sometimes causes type checking errors. · Issue #52570 · microsoft/TypeScript · GitHub
Open Graph Title: Recursive type constraint sometimes causes type checking errors. · Issue #52570 · microsoft/TypeScript
X Title: Recursive type constraint sometimes causes type checking errors. · Issue #52570 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms recursive type constraint 🕗 Version & Regression Information This changed between versions 4.9 and 5.0 Beta ⏯ Playground Link Only happens in multi files projects in VS Code. Repo: https://github.com/dragomirtit...
Open Graph Description: Bug Report 🔎 Search Terms recursive type constraint 🕗 Version & Regression Information This changed between versions 4.9 and 5.0 Beta ⏯ Playground Link Only happens in multi files projects in VS Co...
X Description: Bug Report 🔎 Search Terms recursive type constraint 🕗 Version & Regression Information This changed between versions 4.9 and 5.0 Beta ⏯ Playground Link Only happens in multi files projects in V...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/52570
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Recursive type constraint sometimes causes type checking errors.","articleBody":"# Bug Report\r\n\r\n\r\n\r\n### 🔎 Search Terms\r\n\r\nrecursive type constraint \r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This changed between versions 4.9 and 5.0 Beta\r\n\r\n### ⏯ Playground Link\r\n\r\nOnly happens in multi files projects in VS Code. Repo: https://github.com/dragomirtitian/recursive-type-constarint-bug-ts-5.0\r\n\r\n### 💻 Code\r\n\r\n\u003c!-- Please post the relevant code sample here as well-->\r\n```ts\r\n/// types.ts\r\nexport type\u003cT extends Record\u003cstring, (...params: unknown[]) => unknown>> = {\r\n [key in keyof T]: T[key];\r\n};\r\n\r\n/// index.ts\r\nexport declare const value2: {\r\n sliceSelectors: \u003cFuncMap extends import('./types').SelectorMap\u003cFuncMap>>(selectorsBySlice: FuncMap) => { [P in keyof FuncMap]: Parameters\u003cFuncMap[P]> };\r\n};\r\n\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\nWhen you first open the project in VS code you get the errors below. Any further editing of the file makes the error s go away.\r\n\r\n```sh\r\nType parameter 'FuncMap' has a circular constraint.\r\n\r\nType 'FuncMap[P]' does not satisfy the constraint '(...args: any) => any'.\r\n Type 'FuncMap[keyof FuncMap]' is not assignable to type '(...args: any) => any'.\r\n Type 'FuncMap[string] | FuncMap[number] | FuncMap[symbol]' is not assignable to type '(...args: any) => any'.\r\n Type 'FuncMap[string]' is not assignable to type '(...args: any) => any'.\r\n\r\n```\r\n\r\nAlso happens in a custom build tool using the compiler API\r\n\r\n### 🙂 Expected behavior\r\n\r\nThe code either fails all the time or type checks all the time\r\n\r\n\r\nNote: The circular constraint which is present above and seems to trigger the bug doesn’t seem to make much sense in our case, so we took the opportunity to clean up the types, so this is not blocking for us, but the behavior is still very strange.\r\n\r\n","author":{"url":"https://github.com/dragomirtitian","@type":"Person","name":"dragomirtitian"},"datePublished":"2023-02-02T14:56:10Z","url":"https://github.com/microsoft/TypeScript/issues/52570"}
| 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:20efa32a-e4f6-7dff-e0a3-4be9cfb3df64 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC2E:27D3AD:2D0E21B:3933702:6B01B4BA |
| html-safe-nonce | 56ad123bc142a80083d0bbf27f023426907602715f727e90f0774153ba136fed |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzJFOjI3RDNBRDoyRDBFMjFCOjM5MzM3MDI6NkIwMUI0QkEiLCJ2aXNpdG9yX2lkIjoiMzIxNTUxNTU5Mzk0ODExNjE1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 47be2859a55917b62028218686d2038676a71e8764a47a39f4e90a9dc855b839 |
| hovercard-subject-tag | issue:1568205868 |
| 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/52570/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c0f015f92c6e4b87facd57844854453ff2c85177dd2e2e5059692e5c9f859840/microsoft/TypeScript/issues/52570 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c0f015f92c6e4b87facd57844854453ff2c85177dd2e2e5059692e5c9f859840/microsoft/TypeScript/issues/52570 |
| og:image:alt | Bug Report 🔎 Search Terms recursive type constraint 🕗 Version & Regression Information This changed between versions 4.9 and 5.0 Beta ⏯ Playground Link Only happens in multi files projects in VS Co... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dragomirtitian |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width