Title: class constraints · Issue #9776 · microsoft/TypeScript · GitHub
Open Graph Title: class constraints · Issue #9776 · microsoft/TypeScript
X Title: class constraints · Issue #9776 · microsoft/TypeScript
Description: I am looking for a way to get my derived class be inherited from a generic class. This is my naive attempt to get it: export function create
Open Graph Description: I am looking for a way to get my derived class be inherited from a generic class. This is my naive attempt to get it: export function create
X Description: I am looking for a way to get my derived class be inherited from a generic class. This is my naive attempt to get it: export function create<T>(base: { new (value: string): T }) { return new ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/9776
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"class constraints","articleBody":"I am looking for a way to get my derived class be inherited from a **generic** class.\nThis is my naive attempt to get it:\n\n``` typescript\nexport function create\u003cT>(base: { new (value: string): T }) {\n return new class extends base {\n constructor() {\n super('hey');\n }\n };\n}\n```\n\nIt might be that I am just doing it wrong, but looks like a current limitation, if so:\n- allow class expressions to be declared with a constructor function that returns a generic class\n\nIt might require a new syntax for class constraints:\n\n``` typescript\nexport function create\u003cclass T>(base: { new (value: string): T }) {\n return new class extends base {\n constructor() {\n super('hey');\n }\n };\n}\n```\n","author":{"url":"https://github.com/zpdDG4gta8XKpMCd","@type":"Person","name":"zpdDG4gta8XKpMCd"},"datePublished":"2016-07-17T13:58:35Z","url":"https://github.com/microsoft/TypeScript/issues/9776"}
| 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:de1cf80a-94f2-9870-7a59-d18c2b810230 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A324:2978F1:4AC3A9:61FED2:6B00CAA6 |
| html-safe-nonce | 4d2b53e8860151f775e3fe64c7264352724686326fc748207dfa04b237559931 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzI0OjI5NzhGMTo0QUMzQTk6NjFGRUQyOjZCMDBDQUE2IiwidmlzaXRvcl9pZCI6Ijc2MDY2NjY5NzMxNDQ5OTI0MjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8472147964dfc86f9b915b4489df435dec3acbbbdfb0bcb7e23482a791ffded4 |
| hovercard-subject-tag | issue:165977897 |
| 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/9776/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0e3ebe24cd5c1964c2254a6ba92fce4f58df3f0fbd46de59fa75d0e6794ef807/microsoft/TypeScript/issues/9776 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0e3ebe24cd5c1964c2254a6ba92fce4f58df3f0fbd46de59fa75d0e6794ef807/microsoft/TypeScript/issues/9776 |
| og:image:alt | I am looking for a way to get my derived class be inherited from a generic class. This is my naive attempt to get it: export function create |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zpdDG4gta8XKpMCd |
| hostname | github.com |
| expected-hostname | github.com |
| None | 98dc00e171c204462a6f367482a0f8c3c6b5dbca99cd7390e82d2df49ce096e4 |
| 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 | ef013399cf0a3c324bea644a685d7c1e0f06b5b7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width