Title: Wrong type when creating an instance from a type which inherits from a generic class · Issue #6783 · microsoft/TypeScript · GitHub
Open Graph Title: Wrong type when creating an instance from a type which inherits from a generic class · Issue #6783 · microsoft/TypeScript
X Title: Wrong type when creating an instance from a type which inherits from a generic class · Issue #6783 · microsoft/TypeScript
Description: The following code is fine: function create Open Graph Description: The following code is fine: function create X Description: The following code is fine: function create<T>(ctor: { new (): T }) { return new ctor(); } class A { } class B<T> extends A { } let b = create(B); // b: B<any> --> OK But if A ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/6783
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Wrong type when creating an instance from a type which inherits from a generic class","articleBody":"The following code is fine:\n\n```\nfunction create\u003cT>(ctor: { new (): T }) {\n return new ctor();\n}\n\nclass A { }\nclass B\u003cT> extends A { }\nlet b = create(B); // b: B\u003cany> --> OK\n```\n\nBut if A is generic, the type is not correct.\n\n```\nclass A\u003cT> { }\nclass B\u003cT> extends A\u003cT> { }\nlet b = create(B); // b: A\u003cany> --> Should be B\u003cany>\n```\n\nSorry if this has already been reported.\n","author":{"url":"https://github.com/stephanedr","@type":"Person","name":"stephanedr"},"datePublished":"2016-02-01T16:14:10Z","url":"https://github.com/microsoft/TypeScript/issues/6783"}
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:8816e375-386a-9077-8fbf-1b62fd08a1e6 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id DA30:24ACB9:5E8C7A:7F139C:6B00D08C html-safe-nonce e1b1cb7478248ce1e4063a5dd3190744dfbd9fdfe601bb83c07abcd835ef2a04 visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTMwOjI0QUNCOTo1RThDN0E6N0YxMzlDOjZCMDBEMDhDIiwidmlzaXRvcl9pZCI6IjI1MDg4MTUwMjY0NTQ4NDM1MzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== visitor-hmac a7ecf2281a7842367821098758c1e8d618623ff7666f95273c9096dfd8198640 hovercard-subject-tag issue:130406567 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/6783/issue_layout twitter:image https://opengraph.githubassets.com/19710bf9ff5b4e72cedbaa334d49ec50ed3117683a7d94e85d61962b76edbd19/microsoft/TypeScript/issues/6783 twitter:card summary_large_image og:image https://opengraph.githubassets.com/19710bf9ff5b4e72cedbaa334d49ec50ed3117683a7d94e85d61962b76edbd19/microsoft/TypeScript/issues/6783 og:image:alt The following code is fine: function create og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username stephanedr hostname github.com expected-hostname github.com None 85bbdfe2b6ba16e234513bc6ceff5d848ef8449820c900692a2b4e67061931e5 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 4943239a6d2c591325dad6e5c313e1cafda877f6 ui-target full theme-color #1e2327 color-scheme light dark react-app-name issues
URLs of crawlers that visited me.