Title: Assignment incompatibility with structurally equivalent generic mapped types · Issue #12832 · microsoft/TypeScript · GitHub
Open Graph Title: Assignment incompatibility with structurally equivalent generic mapped types · Issue #12832 · microsoft/TypeScript
X Title: Assignment incompatibility with structurally equivalent generic mapped types · Issue #12832 · microsoft/TypeScript
Description: TypeScript Version: nightly (2.2.0-dev.20161211) Code type Mapped1
Open Graph Description: TypeScript Version: nightly (2.2.0-dev.20161211) Code type Mapped1
X Description: TypeScript Version: nightly (2.2.0-dev.20161211) Code type Mapped1<T> = { [P in keyof T]: T[P]; } type Mapped2<T> = { [P in keyof T]: T[P]; } function asMapped2<T>(a: Mapped1<T...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/12832
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Assignment incompatibility with structurally equivalent generic mapped types","articleBody":"\u003c!-- BUGS: Please use this template. -->\r\n\u003c!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->\r\n\u003c!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->\r\n\r\n**TypeScript Version:** nightly (2.2.0-dev.20161211)\r\n\r\n**Code**\r\n\r\n```ts\r\ntype Mapped1\u003cT> = {\r\n [P in keyof T]: T[P];\r\n}\r\n\r\ntype Mapped2\u003cT> = {\r\n [P in keyof T]: T[P];\r\n}\r\n\r\nfunction asMapped2\u003cT>(a: Mapped1\u003cT>): Mapped2\u003cT> {\r\n return a;\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\nNo error.\r\n\r\n**Actual behavior:**\r\n```\r\ntest.ts(10,10): error TS2322: Type 'Mapped1\u003cT>' is not assignable to type 'Mapped2\u003cT>'.\r\n Type 'T[P]' is not assignable to type 'T[P]'. Two different types with this name exist, but they are \r\nunrelated.\r\n```","author":{"url":"https://github.com/BigDataSamuli","@type":"Person","name":"BigDataSamuli"},"datePublished":"2016-12-11T09:56:54Z","url":"https://github.com/microsoft/TypeScript/issues/12832"}
| 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:77e883f4-cd16-fa65-cd5a-196ef6c07075 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D674:D5AA4:D0FCDF:1184D15:6B00F539 |
| html-safe-nonce | 490f20c5fda02138d661998290a55c45da950b3ff4fa219d718bd06cc1183dbd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjc0OkQ1QUE0OkQwRkNERjoxMTg0RDE1OjZCMDBGNTM5IiwidmlzaXRvcl9pZCI6IjI2MTIyNzU0NjI4NTYwNDU4ODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 82222998c9c28b3d161efc7aa020a1726d86267d986738ac582b8f4ca1494d84 |
| hovercard-subject-tag | issue:194823054 |
| 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/12832/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2d450ceedb75d57615b2e30c25b86e65c6b3bc17f43232b0104f1c5c7694daf1/microsoft/TypeScript/issues/12832 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2d450ceedb75d57615b2e30c25b86e65c6b3bc17f43232b0104f1c5c7694daf1/microsoft/TypeScript/issues/12832 |
| og:image:alt | TypeScript Version: nightly (2.2.0-dev.20161211) Code type Mapped1 |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | BigDataSamuli |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width