Title: [Generic type] Function type of the returned result is not mapped to the parameter · Issue #59124 · microsoft/TypeScript · GitHub
Open Graph Title: [Generic type] Function type of the returned result is not mapped to the parameter · Issue #59124 · microsoft/TypeScript
X Title: [Generic type] Function type of the returned result is not mapped to the parameter · Issue #59124 · microsoft/TypeScript
Description: 🔎 Search Terms "Generic Type","Function","Parameters","ReturnType" 🕗 Version & Regression Information This is a bug This changed between versions v5.6.0 ⏯ Playground Link https://www.typescriptlang.org/play/?#code/C4TwDgpgBAKhDOwbmgXigbw...
Open Graph Description: 🔎 Search Terms "Generic Type","Function","Parameters","ReturnType" 🕗 Version & Regression Information This is a bug This changed between versions v5.6.0 ⏯ Playground Link https://www.typescriptlang...
X Description: 🔎 Search Terms "Generic Type","Function","Parameters","ReturnType" 🕗 Version & Regression Information This is a bug This changed between versions v5.6.0 ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/59124
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Generic type] Function type of the returned result is not mapped to the parameter","articleBody":"### 🔎 Search Terms\r\n\r\n\"Generic Type\",\"Function\",\"Parameters\",\"ReturnType\"\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This is a bug\r\n- This changed between versions v5.6.0\r\n\r\n\r\n### ⏯ Playground Link\r\nhttps://www.typescriptlang.org/play/?#code/C4TwDgpgBAKhDOwbmgXigbwFBSgQwC5MdcoBjAewBsKAnIxWgSwDsBzAbhIF8vcAjItlJR+dACYR6URq048uvLFkotE5PFSrwo6YRq1xEQkrhZ4AthCIByMpqpHgNgDSmoAMwCuLMkQA8MFAQAB7AECziOgDWECAUHrAISCgAfAAU0UQwAJS6qcQiuLQQwF60LJjc+DpOyJAA2jAAunyk3G64HVhKWKCQUADCDjp6JA0A0lCsULHxif0QCQbazSYi5lZEE2243r5Ei8v2WvCTzQ02+2Q2rQo9XFiSZFR4JZ4+ZMBMFJUnVABlYDMdhQQLBMIRKKzOLLYanFxQABiEPCkR08O0TQuV0+twyJAAjrQQERMWcWpdNhBbp0oAA6RlvNjwIgABTellKUng-iRqSwOSIACVSuUWPUIHyBcpVOoSvAvFRgLoVkCQWx0nYHE5XFAbHgbDVyL9EDkgA\r\n\r\n### 💻 Code\r\n\r\n```ts\r\ntype TestType = {\r\n a: {\r\n color: string;\r\n };\r\n b: {\r\n border: string;\r\n };\r\n};\r\n\r\nconst calls = {\r\n callTest: {\r\n name: 'callTest',\r\n func: \u003cT extends keyof TestType>(k: T) => {\r\n return {} as TestType[T];\r\n },\r\n },\r\n};\r\n\r\ntype Calls = {\r\n [K in keyof typeof calls]: {\r\n name: K;\r\n func: typeof calls[K]['func'];\r\n };\r\n};\r\n\r\ndeclare const callString = \u003cT extends keyof Calls, F extends Calls[T]['func']>(\r\n qry: Calls[T]['name'],\r\n ...args: Parameters\u003cF>\r\n): ReturnType\u003cF>\r\n\r\nconst result = callString('callTest', 'a' as const)\r\n```\r\n\r\n\r\n### 🙁 Actual behavior\r\n\r\n`result` type is `{color: string} | {border: string}`. The type of the returned result is not mapped to the parameter\r\n\r\n- [ ] \r\n\r\n### 🙂 Expected behavior\r\n\r\n`result` type is `{color: string}`. The type should map to parameter 'a'\r\n\r\n### Additional information about the issue\r\n\r\n_No response_","author":{"url":"https://github.com/inevermore","@type":"Person","name":"inevermore"},"datePublished":"2024-07-03T03:13:15Z","url":"https://github.com/microsoft/TypeScript/issues/59124"}
| 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:18851664-fa5a-43a5-2452-36af9e523be9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBBA:A71F9:28A4A6A:3371155:6B01D530 |
| html-safe-nonce | 573dc706499829c5000f343b0a04d6d43871e87c15baa8182d9ccaf5c2a20198 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkJBOkE3MUY5OjI4QTRBNkE6MzM3MTE1NTo2QjAxRDUzMCIsInZpc2l0b3JfaWQiOiI4MTI4Mzk3Njk1OTI5OTMxMDU2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1552bd9574e08402983baf1db39ea483a27bc2b1624093c73cb9d3ffeed2630a |
| hovercard-subject-tag | issue:2387559304 |
| 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/59124/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5787d55e8f796a1bc3c257b23d98438d9ae0c04351715a5828147d2694dc95d7/microsoft/TypeScript/issues/59124 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5787d55e8f796a1bc3c257b23d98438d9ae0c04351715a5828147d2694dc95d7/microsoft/TypeScript/issues/59124 |
| og:image:alt | 🔎 Search Terms "Generic Type","Function","Parameters","ReturnType" 🕗 Version & Regression Information This is a bug This changed between versions v5.6.0 ⏯ Playground Link https://www.typescriptlang... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | inevermore |
| 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