Title: Bug from #23592 - Type 'keyof U & K' does not satisfy the constraint 'string | number | symbol' · Issue #23648 · microsoft/TypeScript · GitHub
Open Graph Title: Bug from #23592 - Type 'keyof U & K' does not satisfy the constraint 'string | number | symbol' · Issue #23648 · microsoft/TypeScript
X Title: Bug from #23592 - Type 'keyof U & K' does not satisfy the constraint 'string | number | symbol' · Issue #23648 · microsoft/TypeScript
Description: TypeScript Version: 2.9.0-dev.20180424 Search Terms: keyof, intersection, conditional types Code type Example
Open Graph Description: TypeScript Version: 2.9.0-dev.20180424 Search Terms: keyof, intersection, conditional types Code type Example
X Description: TypeScript Version: 2.9.0-dev.20180424 Search Terms: keyof, intersection, conditional types Code type Example<T, U> = { [K in keyof T]: K extends keyof U ? UnexpectedError<K> : NoErrorH...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/23648
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bug from #23592 - Type 'keyof U & K' does not satisfy the constraint 'string | number | symbol'","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨 -->\r\n\u003c!--\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker.\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n * Read the CONTRIBUTING guidelines: https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md\r\n * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n-->\r\n\r\n\u003c!-- If you have a QUESTION:\r\n THIS IS NOT A FORUM FOR QUESTIONS.\r\n Ask questions at http://stackoverflow.com/questions/tagged/typescript\r\n or https://gitter.im/Microsoft/TypeScript\r\n-->\r\n\r\n\u003c!-- If you have a SUGGESTION:\r\n Most suggestion reports are duplicates, please search extra hard before logging a new suggestion.\r\n See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md\r\n-->\r\n\r\n\u003c!-- If you have a BUG:\r\n Please fill in the *entire* template below.\r\n-->\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 2.9.0-dev.20180424\r\n\r\n**Search Terms:** \r\nkeyof, intersection, conditional types\r\n\r\n**Code**\r\n\r\n```ts\r\ntype Example\u003cT, U> = { [K in keyof T]: K extends keyof U ? UnexpectedError\u003cK> : NoErrorHere\u003cK> }\r\n\r\ntype UnexpectedError\u003cT extends PropertyKey> = T\r\ntype NoErrorHere\u003cT extends PropertyKey> = T\r\n```\r\n\r\n**Expected behavior:**\r\nNo errors. \r\n\r\n**Actual behavior:**\r\nError on `K` in `UnexpectedError\u003cK>` with message \r\n```\r\nType 'keyof U & K' does not satisfy the constraint 'string | number | symbol'.\r\n Type 'keyof U & K' is not assignable to type 'symbol'.\r\n```\r\n\r\n**Playground Link:** \r\n[Link](https://www.typescriptlang.org/play/#src=type%20Example%3CT%2C%20U%3E%20%3D%20%7B%20%5BK%20in%20keyof%20T%5D%3A%20K%20extends%20keyof%20U%20%3F%20UnexpectedError%3CK%3E%20%3A%20NoErrorHere%3CK%3E%20%7D%0D%0A%0D%0Atype%20UnexpectedError%3CT%20extends%20PropertyKey%3E%20%3D%20T%0D%0Atype%20NoErrorHere%3CT%20extends%20PropertyKey%3E%20%3D%20T%0D%0A) (no error in playground)\r\n\r\n**Related Issues:**\r\n#23592","author":{"url":"https://github.com/kpdonn","@type":"Person","name":"kpdonn"},"datePublished":"2018-04-24T08:15:29Z","url":"https://github.com/microsoft/TypeScript/issues/23648"}
| 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:d05c17ed-cd65-6d2c-0678-128840e635f8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E92C:3E4205:CB94F4:11169C0:6B00FEC9 |
| html-safe-nonce | 52d9a2cc2a4c50611b4f705a81605d0e5916da29887b2cc43d6772422615e815 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTJDOjNFNDIwNTpDQjk0RjQ6MTExNjlDMDo2QjAwRkVDOSIsInZpc2l0b3JfaWQiOiI1MTI1MjI5MDA2MzMyOTUyMjY1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 0e38a6af70ced35c621f0d5a8e0b8db4fe4407325a0f7394b2e6db27f7f71f29 |
| hovercard-subject-tag | issue:317116900 |
| 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/23648/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a8e64a4fe5d11c3ea6a25f8b0419a71d71369de510282e0a346829d11bae7cb6/microsoft/TypeScript/issues/23648 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a8e64a4fe5d11c3ea6a25f8b0419a71d71369de510282e0a346829d11bae7cb6/microsoft/TypeScript/issues/23648 |
| og:image:alt | TypeScript Version: 2.9.0-dev.20180424 Search Terms: keyof, intersection, conditional types Code type Example |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kpdonn |
| 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