Title: Mapped types with type parameter are not assignable to `{ [key: string]: any}` · Issue #12900 · microsoft/TypeScript · GitHub
Open Graph Title: Mapped types with type parameter are not assignable to `{ [key: string]: any}` · Issue #12900 · microsoft/TypeScript
X Title: Mapped types with type parameter are not assignable to `{ [key: string]: any}` · Issue #12900 · microsoft/TypeScript
Description: TypeScript Version: 2.1.4 and nightly(2.2.0-dev.20161213) Code interface Base { foo: { [key: string]: any }; bar: any; baz: any; } interface E1
Open Graph Description: TypeScript Version: 2.1.4 and nightly(2.2.0-dev.20161213) Code interface Base { foo: { [key: string]: any }; bar: any; baz: any; } interface E1
X Description: TypeScript Version: 2.1.4 and nightly(2.2.0-dev.20161213) Code interface Base { foo: { [key: string]: any }; bar: any; baz: any; } interface E1<T> extends Base { foo: T; } interface Something...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/12900
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mapped types with type parameter are not assignable to `{ [key: string]: any}`","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.4 and nightly(2.2.0-dev.20161213)\r\n\r\n**Code**\r\n\r\n```ts\r\ninterface Base {\r\n foo: { [key: string]: any };\r\n bar: any;\r\n baz: any;\r\n}\r\n\r\ninterface E1\u003cT> extends Base {\r\n foo: T;\r\n}\r\n\r\ninterface Something { name: string, value: string };\r\ninterface E2 extends Base {\r\n foo: Partial\u003cSomething>; // or other mapped type\r\n}\r\n\r\ninterface E3\u003cT> extends Base {\r\n foo: Partial\u003cT>; // or other mapped type\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\nSuccessfully compiled.\r\n\r\n**Actual behavior:**\r\nE1 and E2 are OK, but E3 causes compile error.\r\n```\r\nerror TS2430: Interface 'E3\u003cT>' incorrectly extends interface 'Base'.\r\nTypes of property 'foo' are incompatible.\r\nType 'Partial\u003cT>' is not assignable to type '{ [key: string]: any; }'.\r\n```\r\n","author":{"url":"https://github.com/wonderful-panda","@type":"Person","name":"wonderful-panda"},"datePublished":"2016-12-14T04:37:09Z","url":"https://github.com/microsoft/TypeScript/issues/12900"}
| 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:ae0d5467-930a-512f-241d-022779e9157e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C86A:33D24F:5B7AA9:775086:6B00DEB6 |
| html-safe-nonce | 5152e2c39de86c2569fef34214fa0b57db460413b4ed451acc11be3b4d63fbbf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODZBOjMzRDI0Rjo1QjdBQTk6Nzc1MDg2OjZCMDBERUI2IiwidmlzaXRvcl9pZCI6IjQwNjgzNjIxMDg4Mzg5MjgwNTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 60ce1116e1860125b0011171fb021047237beab452440320f21e946d62309444 |
| hovercard-subject-tag | issue:195438470 |
| 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/12900/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7c8555d8a0f85ee9c09e0983a862ef084940b7bb09ab85969c0302712a792a15/microsoft/TypeScript/issues/12900 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7c8555d8a0f85ee9c09e0983a862ef084940b7bb09ab85969c0302712a792a15/microsoft/TypeScript/issues/12900 |
| og:image:alt | TypeScript Version: 2.1.4 and nightly(2.2.0-dev.20161213) Code interface Base { foo: { [key: string]: any }; bar: any; baz: any; } interface E1 |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wonderful-panda |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width