Title: Parameter of a generic interface doesn't work when it's a generic index of an another interface · Issue #32365 · microsoft/TypeScript · GitHub
Open Graph Title: Parameter of a generic interface doesn't work when it's a generic index of an another interface · Issue #32365 · microsoft/TypeScript
X Title: Parameter of a generic interface doesn't work when it's a generic index of an another interface · Issue #32365 · microsoft/TypeScript
Description: TypeScript Version: typescript@next, typescript@3.5.1 Search Terms: generic index is not assignable Code interface SettingsTypes { audio: { volume: string; }; video: { resulution: string; } } interface Settings Open Graph Description: TypeScript Version: typescript@next, typescript@3.5.1 Search Terms: generic index is not assignable Code interface SettingsTypes { audio: { volume: string; }; video: { resulution: string; } } inter...
X Description: TypeScript Version: typescript@next, typescript@3.5.1 Search Terms: generic index is not assignable Code interface SettingsTypes { audio: { volume: string; }; video: { resulution: string; } } inter...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/32365
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Parameter of a generic interface doesn't work when it's a generic index of an another interface","articleBody":"**TypeScript Version:** typescript@next, typescript@3.5.1\r\n\r\n**Search Terms:**\r\ngeneric index is not assignable \r\n\r\n**Code**\r\n\r\n```ts\r\ninterface SettingsTypes {\r\n audio: {\r\n volume: string;\r\n };\r\n video: {\r\n resulution: string;\r\n }\r\n}\r\n\r\ninterface Settings\u003cParams extends { [K in keyof Params]?: string }> {\r\n config: Params;\r\n};\r\n\r\n// Example 1\r\ntype ThisWorks = Settings\u003cSettingsTypes['audio']>;\r\n\r\n// Example 2\r\ntype ThisDoesntWork\u003cT extends keyof SettingsTypes> = Settings\u003cSettingsTypes[T]>;\r\n\r\n// ERROR:\r\n// Type '{ volume: string; }' is not assignable to type '{ [K in keyof SettingsTypes[T]]?: string | undefined; }'.\r\n\r\n// oh, ok but then why this works?\r\n\r\n// Example 3\r\ntype ThisWorksAgain = Settings\u003c{ volume: string; }>;\r\n```\r\n\r\n**Expected behavior:**\r\nGeneric should work the same if we pass an specific index of an interface (1), a generic index of an interface (2) or when we pass the type directly (3)\r\n\r\n**Actual behavior:**\r\nTypescript throws an error only for the construction `Settings\u003cSettingsTypes[T]>`.\r\n\r\n**Playground Link:** \r\nhttps://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgMoTGUBzAzgFQE8AHCXZAbwChlk4BXAE2AHsAuSm25ANxYBt6AWwgdcYKDgDcXAL4zaPYIwjtO3ZFDL1BWFiDETpcqrKpVQkWIhTpMOXAB4ACnChwh5CAA9IIRuQUyADaANLIoMgA1hCELDDIru6eALoA-IaSINjIsgB86sgI+jDA2BxJHrgy8uYA9HXIAKLeHsT8KACMVGAkKPgAFsC4AOosUFHkALxoGFjZTnbzeESkuMEA5AzMLBspeTJUDc2tQu0oAEw9fciDwwAiLGTgYxOO+Mg+fgHRsfGz9gWqzIBRmSwcjnBQL663w+0OxyaACUkQB5JFsI6NYHIDZBPiCESZaS5DYRcggFhgOi4XBlEBwABGHWQYBYrJueJC4UiMTiCShKxhwTh6WJ2WQAB9kPR-BBSiAIIwpKSAHT1RosAYAGmQLCiyEZ9GpYAGEBAyAA7gNCKyhuRLeNJmkNSc2iyAMzXUi3e2vSYAQWwcEiYLmEPxAmEomQ4iy2BV+SkQA\r\n\r\n**Related Issues:**\r\n32017 and 31904\r\n","author":{"url":"https://github.com/marcingajda","@type":"Person","name":"marcingajda"},"datePublished":"2019-07-11T22:58:44Z","url":"https://github.com/microsoft/TypeScript/issues/32365"}
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:cfb65a3d-a9b0-3208-dd48-f8b4ef631b8e current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id E668:1FAE:164E9E:22B6C0:6B01BCB2 html-safe-nonce 957bebffcf4492b9afe6a1562475c4b6bc3ebd54f842ed534d5811fa3b1d9e6e visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjY4OjFGQUU6MTY0RTlFOjIyQjZDMDo2QjAxQkNCMiIsInZpc2l0b3JfaWQiOiI4MDA5NjExMDI1MjE1MjQxMzk0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= visitor-hmac 529c22a663ae1c997630fbefb578c6f48e3eaa8d41ea8ebf96bbcb773b5fd447 hovercard-subject-tag issue:467143897 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/32365/issue_layout twitter:image https://opengraph.githubassets.com/dcae5461c808c9b672662038f61a035a93dca36ec557d8a431e36756a0335444/microsoft/TypeScript/issues/32365 twitter:card summary_large_image og:image https://opengraph.githubassets.com/dcae5461c808c9b672662038f61a035a93dca36ec557d8a431e36756a0335444/microsoft/TypeScript/issues/32365 og:image:alt TypeScript Version: typescript@next, typescript@3.5.1 Search Terms: generic index is not assignable Code interface SettingsTypes { audio: { volume: string; }; video: { resulution: string; } } inter... og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username marcingajda hostname github.com expected-hostname github.com None cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c 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 8c77c9e8439031ad54c75a250694842892f693e1 ui-target full theme-color #1e2327 color-scheme light dark react-app-name issues
URLs of crawlers that visited me.