Title: Type constraint lost in conditional type · Issue #43578 · microsoft/TypeScript · GitHub
Open Graph Title: Type constraint lost in conditional type · Issue #43578 · microsoft/TypeScript
X Title: Type constraint lost in conditional type · Issue #43578 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms extends contain constraint 🕗 Version & Regression Information 4.3.0-dev.20210407 This was working in the TS 4.3 beta ⏯ Playground Link https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBDAnmYcCCATDAxAllAZxgA...
Open Graph Description: Bug Report 🔎 Search Terms extends contain constraint 🕗 Version & Regression Information 4.3.0-dev.20210407 This was working in the TS 4.3 beta ⏯ Playground Link https://www.typescriptlang.org/play?...
X Description: Bug Report 🔎 Search Terms extends contain constraint 🕗 Version & Regression Information 4.3.0-dev.20210407 This was working in the TS 4.3 beta ⏯ Playground Link https://www.typescriptlang.org/p...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/43578
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type constraint lost in conditional type","articleBody":"# Bug Report\r\n\r\n\u003c!--\r\n Please fill in each section completely. Thank you!\r\n-->\r\n\r\n### 🔎 Search Terms\r\n- extends\r\n- contain\r\n- constraint \r\n\r\n### 🕗 Version & Regression Information\r\n\r\n4.3.0-dev.20210407\r\n\r\nThis was working in the TS 4.3 beta\r\n\r\n### ⏯ Playground Link\r\n\r\nhttps://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBDAnmYcCCATDAxAllAZxgAUBDKUgW2BmCgBUJsBXAOwGMZcJWCAeeuQDmNAHxwAvHADeAKDgK4AbQDScXKzgBrYIggAzOIKgiYAXQBcR4TVVm4oWqwwE4ACgB0X4QSulWiEpmAJSS4gBuELgY8opxAPzuXh4+VmQU1LSEAjYwdqKhEhFRMXFxVpHRsgC+ANyyQA\r\n\r\n### 💻 Code\r\n\r\n\u003c!-- Please post the relevant code sample here as well-->\r\n```ts\r\nexport type AddFirstParameterToFunctions\u003cTarget> = {\r\n [K in keyof Target]: Target[K] extends (...args: any[]) => void\r\n ? (...args: Parameters\u003cTarget[K]>) => void\r\n : void\r\n};\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\n`Parameters\u003cTarget[K]>` has the error:\r\n\r\n```\r\nType 'Target[K]' does not satisfy the constraint '(...args: any) => any'.\r\n Type 'Target[keyof Target]' is not assignable to type '(...args: any) => any'.\r\n Type 'Target[string] | Target[number] | Target[symbol]' is not assignable to type '(...args: any) => any'.\r\n Type 'Target[string]' is not assignable to type '(...args: any) => any'\r\n```\r\n\r\n### 🙂 Expected behavior\r\n\r\nThis code previously compiled without errors in the TS 4.3-beta","author":{"url":"https://github.com/mjbvz","@type":"Person","name":"mjbvz"},"datePublished":"2021-04-07T17:42:04Z","url":"https://github.com/microsoft/TypeScript/issues/43578"}
| 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:2a6d9d7d-7a89-60cc-7b4d-18c2eb290727 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8A9C:2F9AA4:4F5048:695820:6B017A4F |
| html-safe-nonce | 11c8ae664a54e7f63554707168a80bf0c2623c0f6c5099355b7685c14c2bbd1b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTlDOjJGOUFBNDo0RjUwNDg6Njk1ODIwOjZCMDE3QTRGIiwidmlzaXRvcl9pZCI6IjcxMTQ0MDk1ODcyNTU2Mzg2MDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ce6189392f478a969ec757f290b84e1eea8b7f027ae6c14e2f056c2861d201c3 |
| hovercard-subject-tag | issue:852643515 |
| 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/43578/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ed8845457a6679dbaffd33879cc38fcc0fc1c5fb6dd879bae4794eb6c8ba57f2/microsoft/TypeScript/issues/43578 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ed8845457a6679dbaffd33879cc38fcc0fc1c5fb6dd879bae4794eb6c8ba57f2/microsoft/TypeScript/issues/43578 |
| og:image:alt | Bug Report 🔎 Search Terms extends contain constraint 🕗 Version & Regression Information 4.3.0-dev.20210407 This was working in the TS 4.3 beta ⏯ Playground Link https://www.typescriptlang.org/play?... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mjbvz |
| 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