Title: Can't make mapped types with `as` clauses be homomorphic · Issue #40619 · microsoft/TypeScript · GitHub
Open Graph Title: Can't make mapped types with `as` clauses be homomorphic · Issue #40619 · microsoft/TypeScript
X Title: Can't make mapped types with `as` clauses be homomorphic · Issue #40619 · microsoft/TypeScript
Description: I can't seem to find a way to make a mapped object type be homomorphic when it has an as clause. type Getters
Open Graph Description: I can't seem to find a way to make a mapped object type be homomorphic when it has an as clause. type Getters
X Description: I can't seem to find a way to make a mapped object type be homomorphic when it has an as clause. type Getters<T> = { [K in keyof T as `get${capitalize string & K}`]: () => T[K] }; ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/40619
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Can't make mapped types with `as` clauses be homomorphic","articleBody":"I can't seem to find a way to make a mapped object type be homomorphic when it has an `as` clause.\r\n\r\n```ts\r\ntype Getters\u003cT> = {\r\n [K in keyof T as `get${capitalize string & K}`]: () => T[K]\r\n};\r\n\r\ninterface Person {\r\n readonly name: string;\r\n age: number;\r\n location?: string;\r\n}\r\n\r\ntype LazyPerson = Getters\u003cPerson>;\r\n```\r\n\r\nNone of the modifiers from `Person` are preserved on `LazyPerson`. What is the right way to do this? Is there one?","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2020-09-17T19:40:46Z","url":"https://github.com/microsoft/TypeScript/issues/40619"}
| 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:59bb7dba-9444-46d5-ebf6-4bcd888bd076 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8CCA:21BD98:218422E:2A8A7B0:6B01AFAF |
| html-safe-nonce | ee379ac5631530d678cbfc78a8dcc399ed8463cb569676c050ef39d62447e3eb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Q0NBOjIxQkQ5ODoyMTg0MjJFOjJBOEE3QjA6NkIwMUFGQUYiLCJ2aXNpdG9yX2lkIjoiMTk0Mjg0ODA1OTM0OTE5NTk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ff6eb835aefef7d65806f562b5625f178a07d9b7b1fd40a0e0241a6ea2635ca0 |
| hovercard-subject-tag | issue:703859573 |
| 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/40619/issue_layout |
| twitter:image | https://opengraph.githubassets.com/80f8005cd2286e18761176bcf8141b2d0985511d44f36ca9b57a615422a839d6/microsoft/TypeScript/issues/40619 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/80f8005cd2286e18761176bcf8141b2d0985511d44f36ca9b57a615422a839d6/microsoft/TypeScript/issues/40619 |
| og:image:alt | I can't seem to find a way to make a mapped object type be homomorphic when it has an as clause. type Getters |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DanielRosenwasser |
| 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 |
Links:
Viewport: width=device-width