René's URL Explorer Experiment


Title: Generic parameter inference for Promise.then oddity · Issue #11022 · microsoft/TypeScript · GitHub

Open Graph Title: Generic parameter inference for Promise.then oddity · Issue #11022 · microsoft/TypeScript

X Title: Generic parameter inference for Promise.then oddity · Issue #11022 · microsoft/TypeScript

Description: TypeScript Version: 1.8.0 / nightly (2.0.5-dev.20160919) Code interface Thenable { then(then: (value: T) => U | Thenable): Thenable; } declare let x: Thenable; declare function f(): Thenable|null; declare...

Open Graph Description: TypeScript Version: 1.8.0 / nightly (2.0.5-dev.20160919) Code interface Thenable { then(then: (value: T) => U | Thenable): Thenable; } declare let x: Thenable; declare function ...

X Description: TypeScript Version: 1.8.0 / nightly (2.0.5-dev.20160919) Code interface Thenable<T> { then<U>(then: (value: T) => U | Thenable<U>): Thenable<U>; } declare let x: Thenable...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generic parameter inference for Promise.then oddity","articleBody":"**TypeScript Version:**  1.8.0 / nightly (2.0.5-dev.20160919)\n\n**Code**\n\n``` ts\ninterface Thenable\u003cT> {\n  then\u003cU>(then: (value: T) => U | Thenable\u003cU>): Thenable\u003cU>;\n}\n\ndeclare let x: Thenable\u003cstring>;\ndeclare function f(): Thenable\u003cstring|null>|null;\ndeclare function g(): Thenable\u003cstring>;\n\nlet y = x.then((_) => {\n  if (Math.random() \u003c 0.5) {\n    return f();\n  } else {\n    return g();\n  }\n});\n```\n\n**Expected behavior:**\n`U` should be inferred to be `string | null` as that solves the type constraints. It can be verified by explicitly adding `then\u003cstring | null>.(...)` which type checks.\n\n**Actual behavior:** \nTS errors with `Argument of type '(_: string) => Thenable\u003cstring> | null' is not assignable to parameter of type '(value: string) => string | Thenable\u003cstring>'.`\n\n**Oddities:**\nThe following changes make the error disappear, while I expect them to have no relevance to the type of the closure:\n- moving line 5 to line 8 - `declare let x` below `declare function f` and `g`.\n- change of the type of x to `Thenable\u003cnumber>`.\n- add a field of type T to Thenable - `a: T`, that would make `Thenable` strictly covariant.\n- replace with ternary expression - `(_) => (Math.random() \u003c 0.5) ? f() : g()`\n","author":{"url":"https://github.com/rkirov","@type":"Person","name":"rkirov"},"datePublished":"2016-09-20T23:59:13Z","url":"https://github.com/microsoft/TypeScript/issues/11022"}

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:8a39d991-617a-3849-b778-2ca99288d2a3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB2B8:37820D:C6B1BA:10A41D9:6B00EC93
html-safe-nonced8f182686bb97ac6246e2fe784b5091975a527b068bd6b180a5d5bb3fe5101e5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkI4OjM3ODIwRDpDNkIxQkE6MTBBNDFEOTo2QjAwRUM5MyIsInZpc2l0b3JfaWQiOiI3NDc1MzUyNjk0NTc2NzA0NjU5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac9a00dc62fcedf2db6a30f2706279b0c21cd7d2fa1fe9fce416d781c0673f7d36
hovercard-subject-tagissue:178211232
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/11022/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2fd938a71b0b7a0f4c9e0b4cfaca88c90da2dd0664df46c76475e32bae4d84cd/microsoft/TypeScript/issues/11022
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2fd938a71b0b7a0f4c9e0b4cfaca88c90da2dd0664df46c76475e32bae4d84cd/microsoft/TypeScript/issues/11022
og:image:altTypeScript Version: 1.8.0 / nightly (2.0.5-dev.20160919) Code interface Thenable { then(then: (value: T) => U | Thenable): Thenable; } declare let x: Thenable; declare function ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamerkirov
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
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
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/11022#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F11022
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%2F11022
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/11022
Reloadhttps://github.com/microsoft/TypeScript/issues/11022
Reloadhttps://github.com/microsoft/TypeScript/issues/11022
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests308 (308)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/11022
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/11022
Generic parameter inference for Promise.then oddityhttps://github.com/microsoft/TypeScript/issues/11022#top
https://github.com/ahejlsberg
Breaking ChangeWould introduce errors in existing codehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Breaking%20Change%22
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
TypeScript 2.4https://github.com/microsoft/TypeScript/milestone/43
https://github.com/rkirov
Rado Kirov (rkirov)https://github.com/rkirov
on Sep 20, 2016https://github.com/microsoft/TypeScript/issues/11022#issue-178211232
https://github.com/ahejlsberg
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
on Sep 21, 2016https://github.com/microsoft/TypeScript/issues/11022#issuecomment-248665167
https://github.com/rkirov
Rado Kirov (rkirov)https://github.com/rkirov
on Sep 21, 2016https://github.com/microsoft/TypeScript/issues/11022#issuecomment-248741000
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
on Apr 10, 2017https://github.com/microsoft/TypeScript/issues/11022#event-1037222635
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
Design LimitationConstraints of the existing architecture prevent this from being fixedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Limitation%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
on Apr 10, 2017https://github.com/microsoft/TypeScript/issues/11022#event-1037222836
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Design LimitationConstraints of the existing architecture prevent this from being fixedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Limitation%22
on Apr 18, 2017https://github.com/microsoft/TypeScript/issues/11022#event-1047104353
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
TypeScript 2.3.1https://github.com/microsoft/TypeScript/milestone/42
on Apr 18, 2017https://github.com/microsoft/TypeScript/issues/11022#event-1047104431
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#15104https://github.com/microsoft/TypeScript/pull/15104
on Apr 18, 2017https://github.com/microsoft/TypeScript/issues/11022#event-1047211528
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
TypeScript 2.4https://github.com/microsoft/TypeScript/milestone/43
TypeScript 2.3.1https://github.com/microsoft/TypeScript/milestone/42
on Apr 26, 2017https://github.com/microsoft/TypeScript/issues/11022#event-1059370225
Yui (yuit)https://github.com/yuit
Breaking ChangeWould introduce errors in existing codehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Breaking%20Change%22
on Jun 7, 2017https://github.com/microsoft/TypeScript/issues/11022#event-1114218879
microsofthttps://github.com/microsoft
on Jun 19, 2018https://github.com/microsoft/TypeScript/issues/11022#event-1689913711
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/11022
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/11022
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
Breaking ChangeWould introduce errors in existing codehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Breaking%20Change%22
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
TypeScript 2.4https://github.com/microsoft/TypeScript/milestone/43
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.