René's URL Explorer Experiment


Title: Polymorphic `this` and Generics · Issue #6223 · microsoft/TypeScript · GitHub

Open Graph Title: Polymorphic `this` and Generics · Issue #6223 · microsoft/TypeScript

X Title: Polymorphic `this` and Generics · Issue #6223 · microsoft/TypeScript

Description: First, thank you team for polymorphic this. It is really handy! I think I ran into a case though that I am finding challenging, when I need to return a this, but the generics might have changed. For example: class A { private items: T...

Open Graph Description: First, thank you team for polymorphic this. It is really handy! I think I ran into a case though that I am finding challenging, when I need to return a this, but the generics might have changed. Fo...

X Description: First, thank you team for polymorphic this. It is really handy! I think I ran into a case though that I am finding challenging, when I need to return a this, but the generics might have changed. Fo...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/6223

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Polymorphic `this` and Generics","articleBody":"First, thank you team for polymorphic `this`.  It is really handy!\n\nI think I ran into a case though that I am finding challenging, when I need to return a `this`, but the generics might have changed.  For example:\n\n``` typescript\nclass A\u003cT> {\n    private items: T[] = [];\n    map\u003cU>(callback: (item: T, idx: number, a: this) => U): this {\n        // boring implementation details\n    });\n}\n```\n\nWhere I want to be able to change the generic type for the class with a function, but I will be contracting to return the \"current\" class, but I want to guard different generics.  The following seems logical to me, but doesn't appear to be currently supported:\n\n``` typescript\nclass A\u003cT> {\n    private items: T[] = [];\n    map\u003cU>(callback: (item: T, idx: number, a: this) => U): this\u003cU> {\n        // boring implementation details\n    });\n}\n```\n\nWhere if no generics arguments are supplied, it is inferred to be the current ones, where as if they are supplied they are substituted.\n","author":{"url":"https://github.com/kitsonk","@type":"Person","name":"kitsonk"},"datePublished":"2015-12-23T11:35:23Z","url":"https://github.com/microsoft/TypeScript/issues/6223"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:ccd286e6-a8f8-ade8-25f4-2a811caa0df9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE15E:20AA01:106219B:14F7B06:6B0101D2
html-safe-nonce9c61e203710bbd534f8347c8805d5889ab39e21fb80bd48aa2cd63b9a8bf2788
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTVFOjIwQUEwMToxMDYyMTlCOjE0RjdCMDY6NkIwMTAxRDIiLCJ2aXNpdG9yX2lkIjoiNzM4NDk3NjcyMTQyMzk1ODQ4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacc6558678142d6e25245edc2685cbee1ceae5ab6b62cad677626335937ed575ff
hovercard-subject-tagissue:123644145
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/6223/issue_layout
twitter:imagehttps://opengraph.githubassets.com/383fb8f1c1ff13b2c15a783f939e70f1e46ef4ad16cb156e46ebb07c1e362fbb/microsoft/TypeScript/issues/6223
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/383fb8f1c1ff13b2c15a783f939e70f1e46ef4ad16cb156e46ebb07c1e362fbb/microsoft/TypeScript/issues/6223
og:image:altFirst, thank you team for polymorphic this. It is really handy! I think I ran into a case though that I am finding challenging, when I need to return a this, but the generics might have changed. Fo...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamekitsonk
hostnamegithub.com
expected-hostnamegithub.com
Nonecb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/6223#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F6223
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F6223
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/6223
Reloadhttps://github.com/microsoft/TypeScript/issues/6223
Reloadhttps://github.com/microsoft/TypeScript/issues/6223
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests309 (309)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/6223
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/6223
Polymorphic this and Genericshttps://github.com/microsoft/TypeScript/issues/6223#top
Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Proposal%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Dec 23, 2015https://github.com/microsoft/TypeScript/issues/6223#issue-123644145
https://github.com/myitcv
Paul Jolly (myitcv)https://github.com/myitcv
on Dec 23, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-166881936
Kitson Kelly (@kitsonk)https://github.com/kitsonk
this comment and the following discussionhttps://github.com/Microsoft/TypeScript/issues/4967#issuecomment-153810944
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Dec 23, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-166888542
#6220https://github.com/microsoft/TypeScript/issues/6220
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Dec 23, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-166889899
Paul Jolly (@myitcv)https://github.com/myitcv
https://github.com/myitcv
Paul Jolly (myitcv)https://github.com/myitcv
on Dec 23, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-166898410
further up the threadhttps://github.com/Microsoft/TypeScript/issues/4967
https://github.com/Igorbek
Igor Oleinikov (Igorbek)https://github.com/Igorbek
on Dec 24, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-167011677
https://github.com/zpdDG4gta8XKpMCd
ZpdDG4gta (zpdDG4gta8XKpMCd)https://github.com/zpdDG4gta8XKpMCd
on Dec 24, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-167025146
#5999https://github.com/microsoft/TypeScript/issues/5999
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Dec 24, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-167064699
Igor Oleinikov (@Igorbek)https://github.com/Igorbek
like thishttp://www.typescriptlang.org/Playground#src=class%20A%3CT%3E%20%7B%0D%0A%20%20%20%20private%20items%3A%20T%5B%5D%20%3D%20%5B%5D%3B%0D%0A%20%20%20%20map%3CU%3E%28callback%3F%3A%20%28item%3A%20T%2C%20idx%3A%20number%2C%20a%3A%20this%29%20%3D%3E%20U%29%3A%20this%20%7B%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20boring%20implementation%20details%0D%0A%09%09return%3B%0D%0A%20%20%20%20%7D%3B%0D%0A%7D%0D%0A%0D%0Aclass%20B%3CR%2C%20T%3E%20extends%20A%3C%5BC%3CR%2C%20T%3E%5D%3E%20%7B%0D%0A%20%20%20%20foo%28%29%3A%20void%20%7B%7D%3B%0D%0A%7D%0D%0A%0D%0Aclass%20C%3CK%2C%20V%3E%20%7B%0D%0A%09map%3A%20%5BK%2C%20V%5D%5B%5D%20%3D%20%5B%5D%3B%0D%0A%7D%0D%0A%0D%0Aconst%20b%20%3D%20new%20B%3Cnumber%2C%20string%3E%28%29.map%3CDate%3E%28%29%3B%0D%0A%0D%0A
Aleksey-Bykovhttps://github.com/Aleksey-Bykov
#5845https://github.com/microsoft/TypeScript/issues/5845
#1213https://github.com/microsoft/TypeScript/issues/1213
#4967https://github.com/microsoft/TypeScript/issues/4967
https://github.com/zpdDG4gta8XKpMCd
ZpdDG4gta (zpdDG4gta8XKpMCd)https://github.com/zpdDG4gta8XKpMCd
on Dec 24, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-167075957
Kitson Kelly (@kitsonk)https://github.com/kitsonk
Mohamed Hegazy (@mhegazy)https://github.com/mhegazy
commenthttps://github.com/Microsoft/TypeScript/issues/5999#issuecomment-163008148
#5999https://github.com/microsoft/TypeScript/issues/5999
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Dec 24, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-167076999
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Dec 24, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-167079766
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Dec 24, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-167087385
Aleksey-Bykovhttps://github.com/Aleksey-Bykov
https://github.com/zpdDG4gta8XKpMCd
ZpdDG4gta (zpdDG4gta8XKpMCd)https://github.com/zpdDG4gta8XKpMCd
on Dec 24, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-167092764
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Dec 25, 2015https://github.com/microsoft/TypeScript/issues/6223#issuecomment-167218526
https://github.com/niieani
Bazyli Brzóska (niieani)https://github.com/niieani
on Jan 30, 2016https://github.com/microsoft/TypeScript/issues/6223#issuecomment-177180485
Kagami Sascha Rosylight (@saschanaz)https://github.com/saschanaz
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Proposal%22
on Feb 19, 2016https://github.com/microsoft/TypeScript/issues/6223#event-556990088
https://github.com/electricessence
electricessencehttps://github.com/electricessence
on Jun 12, 2016https://github.com/microsoft/TypeScript/issues/6223#issuecomment-225465093
https://github.com/dead-claudia
Claudia Meadows (dead-claudia)https://github.com/dead-claudia
on Aug 4, 2017https://github.com/microsoft/TypeScript/issues/6223#issuecomment-320195607
https://github.com/variousauthors
Andre Byrne (variousauthors)https://github.com/variousauthors
on Apr 29, 2018https://github.com/microsoft/TypeScript/issues/6223#issuecomment-385288157
https://github.com/dead-claudia
Claudia Meadows (dead-claudia)https://github.com/dead-claudia
on Apr 29, 2018https://github.com/microsoft/TypeScript/issues/6223#issuecomment-385288653
https://github.com/rdhelms
Robby Helms (rdhelms)https://github.com/rdhelms
on Nov 27, 2019https://github.com/microsoft/TypeScript/issues/6223#issuecomment-559164736
https://github.com/fan-tom
Alexey Gerasimov (fan-tom)https://github.com/fan-tom
on Dec 24, 2019https://github.com/microsoft/TypeScript/issues/6223#issuecomment-568728309
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/6223
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/6223
Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Proposal%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.