René's URL Explorer Experiment


Title: Proposal: structural overloading for interfaces · Issue #4302 · microsoft/TypeScript · GitHub

Open Graph Title: Proposal: structural overloading for interfaces · Issue #4302 · microsoft/TypeScript

X Title: Proposal: structural overloading for interfaces · Issue #4302 · microsoft/TypeScript

Description: An alternative to extends that is mostly identical but with the following variation: instead of erroring when properties are re-declared with different types, it would resolve to the type unions instead (properties having a function type...

Open Graph Description: An alternative to extends that is mostly identical but with the following variation: instead of erroring when properties are re-declared with different types, it would resolve to the type unions in...

X Description: An alternative to extends that is mostly identical but with the following variation: instead of erroring when properties are re-declared with different types, it would resolve to the type unions in...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Proposal: structural overloading for interfaces","articleBody":"An alternative to `extends` that is mostly identical but with the following variation: instead of erroring when properties are re-declared with different types, it would resolve to the type unions instead (properties having a function type are already overloaded in inheritance, so there's no need to address them):\n\n``` ts\ninterface A {\n    x: boolean;\n}\n\ninterface B extends A { // Error! Incorrectly extends A. Types of x are incompatible.\n    x: number;\n}\n\ninterface C overloads A { // OK! x is now of type boolean | number\n    x: number;\n}\n\ninterface D overloads A { // OK! x is now of type boolean | number | string\n    x: number | string;\n}\n\ninterface E overloads A { // OK! x is now of type boolean | (param: number): string\n    x(param: number): string;\n}\n```\n\nAn operator based on this variation of inheritance would have the property that for any two (object or function) interfaces  `A`, `B`,  `A overload B` (illustrative, not suggested, name) can never fail, even if the operands contain incompatible property types (note: this assumes cycles are ignored in the operator version). In contrast to intersection, it wouldn't even fail if `A` is an object type and `B` is a function type, as hybrid object/function types are already allowed by standard inheritance. \n\nThis an attempt to address the [challenge presented by @ahejlsberg](https://github.com/Microsoft/TypeScript/issues/4278#issuecomment-130240112) of having an inheritance-like operation that is guaranteed not to fail when applied to generic type parameters:\n\n``` ts\ndeclare function combine\u003cT, U>(obj1: T, obj2: U): T overload U;\n```\n\nand thus may be used as a replacement to intersection that would be more consistent with the rest of the language (and inheritance logic in particular).\n\nEven though I'm not a computer scientist or a language expert I tried to do my best for giving a basic direction (that is, at least a possible idea) on how to solve this. I'm not in a position to be able to see all the details, nuances or problems for integrating something like this into the language.\n","author":{"url":"https://github.com/rotemdan","@type":"Person","name":"rotemdan"},"datePublished":"2015-08-13T17:44:46Z","url":"https://github.com/microsoft/TypeScript/issues/4302"}

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:3fa07f2b-5bc8-8a92-3c3e-38acefc2c69c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idED86:3DF0BE:786B91:9E382F:6B00D99F
html-safe-noncea0c9763c17353d4470f3b123334f3e0645a81f63d43f164d7a3105a2a3e39948
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDg2OjNERjBCRTo3ODZCOTE6OUUzODJGOjZCMDBEOTlGIiwidmlzaXRvcl9pZCI6IjczODcxOTUxMTgyNTQwNjM2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac1c4890efea4c375a0b09a54649cdc2bf2c4a952510242689e53a3abb6dec8090
hovercard-subject-tagissue:100827909
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/4302/issue_layout
twitter:imagehttps://opengraph.githubassets.com/174c4db2247c75b99f5139e849b3b9f0edeca34c7bc9b5a7ca38d67bf8438485/microsoft/TypeScript/issues/4302
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/174c4db2247c75b99f5139e849b3b9f0edeca34c7bc9b5a7ca38d67bf8438485/microsoft/TypeScript/issues/4302
og:image:altAn alternative to extends that is mostly identical but with the following variation: instead of erroring when properties are re-declared with different types, it would resolve to the type unions in...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamerotemdan
hostnamegithub.com
expected-hostnamegithub.com
Nonea481f62a1e04c9b9bdcb5628230682c66d59006f5b13b080f79cba84a176905b
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
release84c8c5cc25e2fb7f2308428458538436baecc6d2
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/4302#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F4302
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%2F4302
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/4302
Reloadhttps://github.com/microsoft/TypeScript/issues/4302
Reloadhttps://github.com/microsoft/TypeScript/issues/4302
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests307 (307)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/4302
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/4302
Proposal: structural overloading for interfaceshttps://github.com/microsoft/TypeScript/issues/4302#top
DeclinedThe issue was declined as something which matches the TypeScript visionhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Declined%22
Out of ScopeThis idea sits outside of the TypeScript language design constraintshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Out%20of%20Scope%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Aug 13, 2015https://github.com/microsoft/TypeScript/issues/4302#issue-100827909
challenge presented by @ahejlsberghttps://github.com/Microsoft/TypeScript/issues/4278#issuecomment-130240112
Nexthttps://github.com/microsoft/TypeScript/issues/4302?timeline_page=1
https://github.com/JsonFreeman
Jason Freeman (JsonFreeman)https://github.com/JsonFreeman
on Aug 14, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-130980327
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Aug 14, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-131048667
Jason Freeman (@JsonFreeman)https://github.com/JsonFreeman
Rotem Dan (rotemdan)https://github.com/rotemdan
on Aug 14, 2015https://github.com/microsoft/TypeScript/issues/4302#event-382395529
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Aug 14, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-131053265
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Aug 14, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-131062092
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Aug 14, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-131106050
jQuery.extendhttps://api.jquery.com/jquery.extend/
https://github.com/JsonFreeman
Jason Freeman (JsonFreeman)https://github.com/JsonFreeman
on Aug 14, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-131233085
#4302 (comment)https://github.com/microsoft/TypeScript/issues/4302#issuecomment-131048667
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Aug 15, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-131281526
Jason Freeman (@JsonFreeman)https://github.com/JsonFreeman
Anders Hejlsberg (@ahejlsberg)https://github.com/ahejlsberg
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Aug 26, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-134902878
Jason Freeman (@JsonFreeman)https://github.com/JsonFreeman
Anders Hejlsberg (@ahejlsberg)https://github.com/ahejlsberg
"intersect" a primitive with an objecthttps://github.com/Microsoft/TypeScript/issues/4372
intersections of interfaces with construct signatureshttps://github.com/Microsoft/TypeScript/issues/3916
Create intersection types when interface members conflicthttps://github.com/Microsoft/TypeScript/issues/3375
Intersection types with duplicated properties of different typeshttps://github.com/Microsoft/TypeScript/issues/4275
local typeshttps://github.com/Microsoft/TypeScript/pull/3266
https://github.com/JsonFreeman
Jason Freeman (JsonFreeman)https://github.com/JsonFreeman
on Aug 26, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-135121628
Rotem Dan (@rotemdan)https://github.com/rotemdan
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Aug 26, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-135132806
Jason Freeman (@JsonFreeman)https://github.com/JsonFreeman
https://github.com/JsonFreeman
Jason Freeman (JsonFreeman)https://github.com/JsonFreeman
on Aug 27, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-135300897
Anders Hejlsberg (@ahejlsberg)https://github.com/ahejlsberg
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Aug 27, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-135307009
Jason Freeman (@JsonFreeman)https://github.com/JsonFreeman
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Aug 30, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-136157179
Jason Freeman (@JsonFreeman)https://github.com/JsonFreeman
https://github.com/JsonFreeman
Jason Freeman (JsonFreeman)https://github.com/JsonFreeman
on Aug 31, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-136221983
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Sep 2, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-136954185
Jason Freeman (@JsonFreeman)https://github.com/JsonFreeman
https://github.com/JsonFreeman
Jason Freeman (JsonFreeman)https://github.com/JsonFreeman
on Sep 2, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-136958988
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Sep 2, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-136959453
Jason Freeman (@JsonFreeman)https://github.com/JsonFreeman
serious implications about subtypinghttps://github.com/Microsoft/TypeScript/issues/4540
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Sep 2, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-136960952
Jason Freeman (@JsonFreeman)https://github.com/JsonFreeman
https://github.com/JsonFreeman
Jason Freeman (JsonFreeman)https://github.com/JsonFreeman
on Sep 2, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-137196391
https://github.com/JsonFreeman
Jason Freeman (JsonFreeman)https://github.com/JsonFreeman
on Sep 2, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-137197081
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
DeclinedThe issue was declined as something which matches the TypeScript visionhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Declined%22
Out of ScopeThis idea sits outside of the TypeScript language design constraintshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Out%20of%20Scope%22
on Sep 17, 2015https://github.com/microsoft/TypeScript/issues/4302#event-412703743
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 17, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-141280271
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 17, 2015https://github.com/microsoft/TypeScript/issues/4302#event-412705973
https://github.com/rotemdan
Rotem Dan (rotemdan)https://github.com/rotemdan
on Sep 18, 2015https://github.com/microsoft/TypeScript/issues/4302#issuecomment-141354229
Mohamed Hegazy (@mhegazy)https://github.com/mhegazy
https://github.com/wclr
Alex (wclr)https://github.com/wclr
on Sep 11, 2016https://github.com/microsoft/TypeScript/issues/4302#issuecomment-246180247
https://github.com/woutervh-
woutervh-https://github.com/woutervh-
on Nov 9, 2017https://github.com/microsoft/TypeScript/issues/4302#issuecomment-343183625
microsofthttps://github.com/microsoft
on Jun 19, 2018https://github.com/microsoft/TypeScript/issues/4302#event-1689610540
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/4302
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/4302
DeclinedThe issue was declined as something which matches the TypeScript visionhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Declined%22
Out of ScopeThis idea sits outside of the TypeScript language design constraintshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Out%20of%20Scope%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.