René's URL Explorer Experiment


Title: Issue a warning when generic type inference produces {} · Issue #360 · microsoft/TypeScript · GitHub

Open Graph Title: Issue a warning when generic type inference produces {} · Issue #360 · microsoft/TypeScript

X Title: Issue a warning when generic type inference produces {} · Issue #360 · microsoft/TypeScript

Description: Motivating example (one of many): function compare(lhs: T, rhs: T): boolean { return lhs === rhs; } if(compare('1', 1)) { // Expected: Error -- I made 'compare' generic for a reason! /* ... */ } Proposal When generic type inference pe...

Open Graph Description: Motivating example (one of many): function compare(lhs: T, rhs: T): boolean { return lhs === rhs; } if(compare('1', 1)) { // Expected: Error -- I made 'compare' generic for a reason! /* ... */ }...

X Description: Motivating example (one of many): function compare<T>(lhs: T, rhs: T): boolean { return lhs === rhs; } if(compare('1', 1)) { // Expected: Error -- I made 'compare' generic for...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Issue a warning when generic type inference produces {}","articleBody":"Motivating example (one of many):\n\n``` ts\nfunction compare\u003cT>(lhs: T, rhs: T): boolean {\n  return lhs === rhs;\n}\n\nif(compare('1', 1)) { // Expected: Error -- I made 'compare' generic for a reason!\n  /* ... */\n}\n```\n### Proposal\n\nWhen generic type inference performs its Best Common Type operation (4.12.2), it should be an error if this returns `{}` when `{}` was not one of the input types.\n\nThis is entirely consistent with other behavior already in the compiler:\n\n``` ts\nvar foo = bar ? '1' : 1; // Error, no BCT between '1' and 1\nfunction fn() { // Error, no BCT between '1' and 1\n  if(foo) {\n    return '1';\n  } else {\n    return 1;\n  }\n}\n```\n### Open Questions\n\nFrom @KamyarNazeri -- should this apply when there are zero input types? e.g.:\n\n``` ts\nclass List\u003cT> {\n    items: T[];\n}\n\nvar x = new List(); // Probably want an error here\n```\n\nThat seems desirable, but has some collateral damage:\n\n``` ts\nfunction foo\u003cT>(x: number, a?: T, b?: T) { }\nfoo(0); // Error, zero input types provided for inference\n```\n\nThis would come up slightly more often than naively expected because many .d.ts authors (mistakenly) create generic types which don't actually consume their type parameters. Perhaps this warning would effectively discourage them from doing so?\n","author":{"url":"https://github.com/RyanCavanaugh","@type":"Person","name":"RyanCavanaugh"},"datePublished":"2014-08-05T04:12:30Z","url":"https://github.com/microsoft/TypeScript/issues/360"}

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:6fb57f31-8a33-8577-31e5-d52f6638ead1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB03C:2D8388:18132F:218905:6B008396
html-safe-noncee692135c037008366f1df31ae2e5d87320bc54aa11916b7a40291bf3acb1aa73
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDNDOjJEODM4ODoxODEzMkY6MjE4OTA1OjZCMDA4Mzk2IiwidmlzaXRvcl9pZCI6IjMwMjk2MTA1NTAxNzU3NjEzMDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac9f198af4e0d101cd748e8f2c2eb5ee28e3626252c796cb5ec58240026a30c3d5
hovercard-subject-tagissue:39483759
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/360/issue_layout
twitter:imagehttps://opengraph.githubassets.com/8d729da65c6a25fbdeeddb45b02356b3cb35c3c8b2202d0ecf2041b042ecdf95/microsoft/TypeScript/issues/360
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/8d729da65c6a25fbdeeddb45b02356b3cb35c3c8b2202d0ecf2041b042ecdf95/microsoft/TypeScript/issues/360
og:image:altMotivating example (one of many): function compare(lhs: T, rhs: T): boolean { return lhs === rhs; } if(compare('1', 1)) { // Expected: Error -- I made 'compare' generic for a reason! /* ... */ }...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameRyanCavanaugh
hostnamegithub.com
expected-hostnamegithub.com
None4d3d8e50f02c1d7bf86d5acfa1d3bfe9366abd6528a6b429eb07a168429d2b61
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
releasedb758f8e02b8257935fb03edf81a3e76eb3abd11
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/360#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F360
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%2F360
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/360
Reloadhttps://github.com/microsoft/TypeScript/issues/360
Reloadhttps://github.com/microsoft/TypeScript/issues/360
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests310 (310)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/360
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/360
Issue a warning when generic type inference produces {}https://github.com/microsoft/TypeScript/issues/360#top
DeclinedThe issue was declined as something which matches the TypeScript visionhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Declined%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Aug 5, 2014https://github.com/microsoft/TypeScript/issues/360#issue-39483759
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Suggestionhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
on Aug 5, 2014https://github.com/microsoft/TypeScript/issues/360#event-149081174
https://github.com/basarat
Basarat Ali Syed (basarat)https://github.com/basarat
on Aug 5, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-51156034
https://github.com/johnnyreilly
John Reilly (johnnyreilly)https://github.com/johnnyreilly
on Aug 5, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-51159107
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Aug 5, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-51202327
https://github.com/knazeri
Kamyar Nazeri (knazeri)https://github.com/knazeri
on Aug 5, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-51222702
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Aug 6, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-51401079
Jason Freeman (@JsonFreeman)https://github.com/JsonFreeman
Vladimir Matveev (@vladima)https://github.com/vladima
https://github.com/JsonFreeman
Jason Freeman (JsonFreeman)https://github.com/JsonFreeman
on Aug 6, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-51402356
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Aug 6, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-51406095
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Aug 6, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-51406530
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
#274https://github.com/microsoft/TypeScript/issues/274
#360https://github.com/microsoft/TypeScript/issues/360
https://github.com/basarat
Basarat Ali Syed (basarat)https://github.com/basarat
on Aug 7, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-51445227
https://github.com/zpdDG4gta8XKpMCd
ZpdDG4gta (zpdDG4gta8XKpMCd)https://github.com/zpdDG4gta8XKpMCd
on Aug 18, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-52503712
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
thishttps://github.com/Microsoft/TypeScript/issues/321#issuecomment-50926775
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Aug 18, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-52518667
https://github.com/zpdDG4gta8XKpMCd
ZpdDG4gta (zpdDG4gta8XKpMCd)https://github.com/zpdDG4gta8XKpMCd
on Aug 18, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-52520971
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
poor-man units of measurehttps://github.com/Microsoft/TypeScript/issues/364#issuecomment-51573638
https://github.com/JsonFreeman
Jason Freeman (JsonFreeman)https://github.com/JsonFreeman
on Aug 18, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-52527110
https://github.com/zpdDG4gta8XKpMCd
ZpdDG4gta (zpdDG4gta8XKpMCd)https://github.com/zpdDG4gta8XKpMCd
on Aug 19, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-52601080
https://github.com/danquirk
Dan Quirk (danquirk)https://github.com/danquirk
on Aug 19, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-52659600
https://github.com/danquirk
Dan Quirk (danquirk)https://github.com/danquirk
on Oct 27, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-60683162
#868https://github.com/microsoft/TypeScript/issues/868
https://github.com/JsonFreeman
Jason Freeman (JsonFreeman)https://github.com/JsonFreeman
on Oct 27, 2014https://github.com/microsoft/TypeScript/issues/360#issuecomment-60683575
#951https://github.com/microsoft/TypeScript/pull/951
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
DeclinedThe issue was declined as something which matches the TypeScript visionhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Declined%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 Dec 2, 2015https://github.com/microsoft/TypeScript/issues/360#event-479669143
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Dec 2, 2015https://github.com/microsoft/TypeScript/issues/360#issuecomment-161149086
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Dec 2, 2015https://github.com/microsoft/TypeScript/issues/360#event-479669268
microsofthttps://github.com/microsoft
on Jun 18, 2018https://github.com/microsoft/TypeScript/issues/360#event-1686904293
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/360
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/360
DeclinedThe issue was declined as something which matches the TypeScript visionhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Declined%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.