Title: Two equally defined mapped types are incompatible · Issue #14613 · microsoft/TypeScript · GitHub
Open Graph Title: Two equally defined mapped types are incompatible · Issue #14613 · microsoft/TypeScript
X Title: Two equally defined mapped types are incompatible · Issue #14613 · microsoft/TypeScript
Description: TypeScript Version: 2.1.5 Code class A
Open Graph Description: TypeScript Version: 2.1.5 Code class A
X Description: TypeScript Version: 2.1.5 Code class A<T> { a: T } type M<T> = {[P in keyof T]: A<T[P]>} function foo<T>(m: (t: T) => M<T>, t: T) { let x: {[P in keyof T]: A<T[P...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/14613
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Two equally defined mapped types are incompatible","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:** 2.1.5\r\n\r\n**Code**\r\n\r\n```ts\r\nclass A\u003cT> { a: T }\r\ntype M\u003cT> = {[P in keyof T]: A\u003cT[P]>}\r\n\r\nfunction foo\u003cT>(m: (t: T) => M\u003cT>, t: T) {\r\n let x: {[P in keyof T]: A\u003cT[P]> } = m(t);\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nShould compile.\r\n\r\n**Actual behavior:**\r\n\r\nFails to compile at the initialization of `x` with the claim the types were incompatible:\r\n\r\n```\r\napp.ts(200,9): error TS2322: Type 'M\u003cT>' is not assignable to type '{ [P in keyof T]: A\u003cT[P]>; }'.\r\n Type 'A\u003cT[P]>' is not assignable to type 'A\u003cT[P]>'. Two different types with this name exist, but they are unrelated.\r\n\r\n Type 'T[P]' is not assignable to type 'T[P]'. Two different types with this name exist, but they are unrelated.\r\n```\r\n\r\n(Maybe this is the expected behavior for some reason, but it seems off to me.)","author":{"url":"https://github.com/jtheisen","@type":"Person","name":"jtheisen"},"datePublished":"2017-03-12T21:04:12Z","url":"https://github.com/microsoft/TypeScript/issues/14613"}
| 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:b9ac1dfe-4912-9874-938d-fac0c07e5b8b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E4C0:3F8AB1:101E704:14A70DF:6B00FF17 |
| html-safe-nonce | 3971ec08e794ef565844c5de4c3f38faa1529bc8872f2c49abaf3addc181572c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNEMwOjNGOEFCMToxMDFFNzA0OjE0QTcwREY6NkIwMEZGMTciLCJ2aXNpdG9yX2lkIjoiMzkyMDM0MTk5NjYyNzA5OTQxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 545f5d53cfe1ec73f118a076046cdf98523e1e1d1c31888d91997b80266b7efc |
| hovercard-subject-tag | issue:213634700 |
| 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/14613/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3102e23c60fd2833214c4833bbbb127827b8ef3918170da20af7ba751ab9e7f4/microsoft/TypeScript/issues/14613 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3102e23c60fd2833214c4833bbbb127827b8ef3918170da20af7ba751ab9e7f4/microsoft/TypeScript/issues/14613 |
| og:image:alt | TypeScript Version: 2.1.5 Code class A |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jtheisen |
| 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