Title: Allow negated types + F-bounded mapped types · Issue #18280 · microsoft/TypeScript · GitHub
Open Graph Title: Allow negated types + F-bounded mapped types · Issue #18280 · microsoft/TypeScript
X Title: Allow negated types + F-bounded mapped types · Issue #18280 · microsoft/TypeScript
Description: Edit: keyof works as I thought; mapped types are just broken in interfaces. I also clarified a few things. Allowing negated types and F-bounded mapped type variables would solve several issues: Subtraction types: #4183 - The proposed A -...
Open Graph Description: Edit: keyof works as I thought; mapped types are just broken in interfaces. I also clarified a few things. Allowing negated types and F-bounded mapped type variables would solve several issues: Sub...
X Description: Edit: keyof works as I thought; mapped types are just broken in interfaces. I also clarified a few things. Allowing negated types and F-bounded mapped type variables would solve several issues: Sub...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/18280
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Allow negated types + F-bounded mapped types","articleBody":"**Edit:** `keyof` works as I thought; mapped types are just [broken in interfaces](https://github.com/Microsoft/TypeScript/issues/18299). I also clarified a few things.\r\n\r\nAllowing negated types and F-bounded mapped type variables would solve several issues:\r\n\r\n- Subtraction types: #4183 - The proposed `A - B` could be encoded as `A & !B` as per this proposal.\r\n- Mapped conditional types: #12424 - For key-based conditions, this + F-bounded mapped types would allow that to be solved without explicit support.\r\n- Promises - Having negated types makes it possible to [prevent thenables from being used as generic Promise parameters](https://github.com/Microsoft/TypeScript/issues/4183#issuecomment-327324792).\r\n\r\nHere's my proposal:\r\n\r\n1. Allow negated types, using `!T` to represent the set of all types that do *not* conform to `T` (i.e. not assignable to `T`). This is pretty simple to digest.\r\n\r\n2. Expand mapped types to allow the key variable to be F-bounded, like in `{[P in Keys\u003cT, P>]: ...}`.\r\n\r\nThe first is sufficient to cover subtraction types and Promise type issues, and the other two make mapped conditional types possible.","author":{"url":"https://github.com/dead-claudia","@type":"Person","name":"dead-claudia"},"datePublished":"2017-09-06T17:12:34Z","url":"https://github.com/microsoft/TypeScript/issues/18280"}
| 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:15d4232e-e311-635f-9179-db732f6f8fa7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C3EE:25598F:750A70:9D198B:6B00D9B8 |
| html-safe-nonce | 58a033bea5ea695289618837165fe449e86d95a1cb4c0f974fc337bb36b122bc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDM0VFOjI1NTk4Rjo3NTBBNzA6OUQxOThCOjZCMDBEOUI4IiwidmlzaXRvcl9pZCI6IjQwMjY4NTcyOTI5NDIwNzIyNDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c70a889f4013480d49d6f825caa1750df7e7996550e24d7aec222e8ed3d3cb8c |
| hovercard-subject-tag | issue:255678650 |
| 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/18280/issue_layout |
| twitter:image | https://opengraph.githubassets.com/149cd38890e7ba47946327f0fbc05e971748123da89ea89ae6c7aaea0bae7339/microsoft/TypeScript/issues/18280 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/149cd38890e7ba47946327f0fbc05e971748123da89ea89ae6c7aaea0bae7339/microsoft/TypeScript/issues/18280 |
| og:image:alt | Edit: keyof works as I thought; mapped types are just broken in interfaces. I also clarified a few things. Allowing negated types and F-bounded mapped type variables would solve several issues: Sub... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dead-claudia |
| hostname | github.com |
| expected-hostname | github.com |
| None | a481f62a1e04c9b9bdcb5628230682c66d59006f5b13b080f79cba84a176905b |
| 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 | 84c8c5cc25e2fb7f2308428458538436baecc6d2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width