Title: `keyof FilteringMappedType` can't compute its constraint · Issue #56239 · microsoft/TypeScript · GitHub
Open Graph Title: `keyof FilteringMappedType` can't compute its constraint · Issue #56239 · microsoft/TypeScript
X Title: `keyof FilteringMappedType` can't compute its constraint · Issue #56239 · microsoft/TypeScript
Description: 🔎 Search Terms keyof index constraint filtering mapped 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link https://www.typescriptlang.org/play?ts=5.3.0-dev.20231027#code/C4TwDgpgBAaghgGwK4QM...
Open Graph Description: 🔎 Search Terms keyof index constraint filtering mapped 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link https://www.typescriptlang.org/play?ts=5.3....
X Description: 🔎 Search Terms keyof index constraint filtering mapped 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link https://www.typescriptlang.org/play?ts=...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/56239
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`keyof FilteringMappedType` can't compute its constraint","articleBody":"### 🔎 Search Terms\n\nkeyof index constraint filtering mapped \n\n### 🕗 Version & Regression Information\n\n- This is the behavior in every version I tried\n\n### ⏯ Playground Link\n\nhttps://www.typescriptlang.org/play?ts=5.3.0-dev.20231027#code/C4TwDgpgBAaghgGwK4QM4B4AqA+KBeKTAbQGsIQB7AM0IF0BuAKEdEigAUAnCgNwEsAJhAEBBAMbAKnfFADejKFFScxALiXBOfAHYBzJooQVdfNVCTaS2igHdtTAL5NGO4BE5U4Y6AGVgcNwBZLwALHQgAYQptKj5dLHFJTlQoCAAPN20BFK5eQWFEqVx5RR0eCjJ1EsUlFXVMQuSiACJlMWaGBSgnRgdmITEEOE5oKgsJPmilCGAkMASJKRT0zOyoACUIMSkBdFRNHV0AGnNLaztsbAAKAH0qrq8k1HuaqCIAaSgdKDJKGgbFslaPVGqgPp1FD0HABKF5QMQjAIQYJiMLaCDqK5dRTbGJxdR+JEotGRaKxeLYmrwZBodDVV6KD5fbQ-cjUQigqBwFKfABkGi0emBckpDNqZneBjFNSMJjMAKe4KlYp6KuwlOwRy60PwuHKgkcTCAA\n\n### 💻 Code\n\n```ts\r\ntype Values\u003cT> = T[keyof T];\r\n\r\ntype ProvidedActor = {\r\n src: string;\r\n logic: unknown;\r\n};\r\n\r\ninterface StateMachineConfig\u003cTActors extends ProvidedActor> {\r\n invoke: {\r\n src: TActors[\"src\"];\r\n };\r\n}\r\n\r\ndeclare function setup\u003cTActors extends Record\u003cstring, unknown>>(_: {\r\n actors: {\r\n [K in keyof TActors]: TActors[K];\r\n };\r\n}): {\r\n createMachine: (\r\n config: StateMachineConfig\u003c\r\n Values\u003c{\r\n [K in keyof TActors as K & string]: {\r\n src: K;\r\n logic: TActors[K];\r\n };\r\n }>\r\n >,\r\n ) => void;\r\n};\r\n```\r\n\n\n### 🙁 Actual behavior\n\n```\r\nType 'Values\u003c{ [K in keyof TActors as K & string]: { src: K; logic: TActors[K]; }; }>' does not satisfy the constraint 'ProvidedActor'.\r\n Types of property 'src' are incompatible.\r\n Type 'keyof { [K in keyof TActors as K & string]: { src: K; logic: TActors[K]; }; }' is not assignable to type 'string'.\r\n Type 'string | number | symbol' is not assignable to type 'string'.\r\n Type 'number' is not assignable to type 'string'.(2344)\r\n```\n\n### 🙂 Expected behavior\n\nIt should typecheck\n\n### Additional information about the issue\n\nAlmost the same thing typechecks OK if we refactor this to `[K in keyof TActors & string]`.","author":{"url":"https://github.com/Andarist","@type":"Person","name":"Andarist"},"datePublished":"2023-10-28T12:06:48Z","url":"https://github.com/microsoft/TypeScript/issues/56239"}
| 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:899432eb-cc00-a808-d57b-5f9261973a18 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E252:1148D3:23C0C3B:2D9F6B1:6B018960 |
| html-safe-nonce | 0d9a309412b1b84dbafbcd5eed8b684027a6208e33317735bf51cdf337f00f10 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjUyOjExNDhEMzoyM0MwQzNCOjJEOUY2QjE6NkIwMTg5NjAiLCJ2aXNpdG9yX2lkIjoiODMwNzU1MzgzNDI1MTY4NDE5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f093321fceca0bedd1660d1a474cb8de88f0f08209e7ab7d29f78716db61737f |
| hovercard-subject-tag | issue:1966570118 |
| 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/56239/issue_layout |
| twitter:image | https://opengraph.githubassets.com/38917d7c88c32cfffb4870359e6b8042a986396268f1f8538f7ce5143b746745/microsoft/TypeScript/issues/56239 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/38917d7c88c32cfffb4870359e6b8042a986396268f1f8538f7ce5143b746745/microsoft/TypeScript/issues/56239 |
| og:image:alt | 🔎 Search Terms keyof index constraint filtering mapped 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link https://www.typescriptlang.org/play?ts=5.3.... |
| 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 | 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