René's URL Explorer Experiment


Title: Consider re-ordering Array#reduce overloads in lib.d.ts · Issue #7014 · microsoft/TypeScript · GitHub

Open Graph Title: Consider re-ordering Array#reduce overloads in lib.d.ts · Issue #7014 · microsoft/TypeScript

X Title: Consider re-ordering Array#reduce overloads in lib.d.ts · Issue #7014 · microsoft/TypeScript

Description: Example code: type UnaryFunction = (arg1) => any; type BinaryFunction = (arg1, arg2) => any; let binaryFuncs: BinaryFunction[] = []; let unaryFunc = arg1 => {}; let reduced = binaryFuncs.reduce((prev, next) => prev, unaryFunc); // ACTUAL...

Open Graph Description: Example code: type UnaryFunction = (arg1) => any; type BinaryFunction = (arg1, arg2) => any; let binaryFuncs: BinaryFunction[] = []; let unaryFunc = arg1 => {}; let reduced = binaryFuncs.reduce((pr...

X Description: Example code: type UnaryFunction = (arg1) => any; type BinaryFunction = (arg1, arg2) => any; let binaryFuncs: BinaryFunction[] = []; let unaryFunc = arg1 => {}; let reduced = binaryFuncs.r...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Consider re-ordering Array#reduce overloads in lib.d.ts","articleBody":"Example code:\n\n``` typescript\ntype UnaryFunction = (arg1) => any;\ntype BinaryFunction = (arg1, arg2) => any;\n\nlet binaryFuncs: BinaryFunction[] = [];\nlet unaryFunc = arg1 => {};\nlet reduced = binaryFuncs.reduce((prev, next) => prev, unaryFunc);\n\n// ACTUAL:\nlet f: UnaryFunction = reduced;     // ERROR binary not assignable to unary\n\n// EXPECTED:\nlet f: UnaryFunction = reduced;     // OK - both lhs and rhs really are unary\n```\n\nThe call to `Array#reduce` in the above example definitely returns a unary function, but the type system erroneously infers the return type as a binary function.\n\nThis seems to be caused by the declaration order of the two overloads of `Array#reduce` in `lib.d.ts`. If the declaration order is reversed, the problem is solved.\n\nThe two overloaded declarations in `lib.d.ts` are as follows:\n\n``` typescript\nreduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\nreduce\u003cU>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n```\n\nThe first overload matches the example with `T=BinaryFunction`, since it satisfies the compiler's assignability checks. So the second overload is never considered, even though it is a strictly better match, with `T=BinaryFunction` and `U=UnaryFunction`.\n\nWould it be possible to swap the overload order for `Array#reduce` (and `Array#reduceRight`) in `lib.d.ts` to resolve this issue?\n","author":{"url":"https://github.com/yortus","@type":"Person","name":"yortus"},"datePublished":"2016-02-11T02:35:29Z","url":"https://github.com/microsoft/TypeScript/issues/7014"}

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:13d90352-52f9-53f8-0617-f81e31491225
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE600:22DB35:F3FA44:13A1191:6B00FE18
html-safe-nonceca2b06c2ba03abd6282cae6f7bb845e9775a3f8fdaef4a8b31e85acf95a8efec
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjAwOjIyREIzNTpGM0ZBNDQ6MTNBMTE5MTo2QjAwRkUxOCIsInZpc2l0b3JfaWQiOiIxMDMxOTk1Njg4NTcwOTEyMjgwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmaca8f9bdc22fa1c324a700c632ad0d0eecbb6d678919524d8e480b4df3c54d3ee4
hovercard-subject-tagissue:132874000
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/7014/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ab259af9f3e275f4434f7eed7e0e96cb802d81a406a39f5362fb11e5f99972cb/microsoft/TypeScript/issues/7014
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ab259af9f3e275f4434f7eed7e0e96cb802d81a406a39f5362fb11e5f99972cb/microsoft/TypeScript/issues/7014
og:image:altExample code: type UnaryFunction = (arg1) => any; type BinaryFunction = (arg1, arg2) => any; let binaryFuncs: BinaryFunction[] = []; let unaryFunc = arg1 => {}; let reduced = binaryFuncs.reduce((pr...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameyortus
hostnamegithub.com
expected-hostnamegithub.com
Nonee208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187
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
release7dafd017fb7809a839c443dba08622af38e63c09
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/7014#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F7014
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%2F7014
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/7014
Reloadhttps://github.com/microsoft/TypeScript/issues/7014
Reloadhttps://github.com/microsoft/TypeScript/issues/7014
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/7014
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/7014
#63440https://github.com/microsoft/TypeScript/pull/63440
#63064https://github.com/microsoft/TypeScript/pull/63064
Consider re-ordering Array#reduce overloads in lib.d.tshttps://github.com/microsoft/TypeScript/issues/7014#top
#63440https://github.com/microsoft/TypeScript/pull/63440
#63064https://github.com/microsoft/TypeScript/pull/63064
Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20lib.d.ts%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
Backloghttps://github.com/microsoft/TypeScript/milestone/29
https://github.com/yortus
Troy Gerwien (yortus)https://github.com/yortus
on Feb 11, 2016https://github.com/microsoft/TypeScript/issues/7014#issue-132874000
https://github.com/yortus
Troy Gerwien (yortus)https://github.com/yortus
on Feb 11, 2016https://github.com/microsoft/TypeScript/issues/7014#issuecomment-183115600
Troy Gerwien (yortus)https://github.com/yortus
on Feb 11, 2016https://github.com/microsoft/TypeScript/issues/7014#event-547930417
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Feb 12, 2016https://github.com/microsoft/TypeScript/issues/7014#issuecomment-183118618
http://typescript.codeplex.com/workitem/2352http://typescript.codeplex.com/workitem/2352
https://github.com/yortus
Troy Gerwien (yortus)https://github.com/yortus
on Feb 12, 2016https://github.com/microsoft/TypeScript/issues/7014#issuecomment-183121437
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on Feb 16, 2016https://github.com/microsoft/TypeScript/issues/7014#event-552672375
https://github.com/aluanhaddad
Aluan Haddad (aluanhaddad)https://github.com/aluanhaddad
on Mar 11, 2016https://github.com/microsoft/TypeScript/issues/7014#issuecomment-195232747
https://github.com/johnnyreilly
John Reilly (johnnyreilly)https://github.com/johnnyreilly
on Apr 4, 2016https://github.com/microsoft/TypeScript/issues/7014#issuecomment-205297206
Troy Gerwien (@yortus)https://github.com/yortus
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Accepting PRshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Accepting%20PRs%22
Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20lib.d.ts%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on Jun 9, 2016https://github.com/microsoft/TypeScript/issues/7014#event-686674081
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jun 9, 2016https://github.com/microsoft/TypeScript/issues/7014#issuecomment-224775889
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Effort: Easyhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Effort%3A%20Easy%22
on Jun 9, 2016https://github.com/microsoft/TypeScript/issues/7014#event-686674477
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Jun 9, 2016https://github.com/microsoft/TypeScript/issues/7014#event-687900939
https://github.com/vilicvane
vilicvane (vilicvane)https://github.com/vilicvane
on Sep 25, 2016https://github.com/microsoft/TypeScript/issues/7014#issuecomment-249400628
https://github.com/bdurrani
Bilal Durrani (bdurrani)https://github.com/bdurrani
on Oct 2, 2018https://github.com/microsoft/TypeScript/issues/7014#issuecomment-426123101
vilichttps://github.com/vilic
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://github.com/vilicvane
vilicvane (vilicvane)https://github.com/vilicvane
on Oct 2, 2018https://github.com/microsoft/TypeScript/issues/7014#issuecomment-426133061
Bilal Durrani (@bdurrani)https://github.com/bdurrani
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Communityhttps://github.com/microsoft/TypeScript/milestone/2
Backloghttps://github.com/microsoft/TypeScript/milestone/29
on Mar 7, 2019https://github.com/microsoft/TypeScript/issues/7014#event-2188550625
https://github.com/chriskrycho
Chris Krycho (chriskrycho)https://github.com/chriskrycho
on Dec 19, 2019https://github.com/microsoft/TypeScript/issues/7014#issuecomment-567682304
#11356https://github.com/microsoft/TypeScript/pull/11356
vilichttps://github.com/vilic
https://github.com/starpit
Nick Mitchell (starpit)https://github.com/starpit
on Dec 20, 2019https://github.com/microsoft/TypeScript/issues/7014#issuecomment-568107915
https://github.com/Meowu
Meowu (Meowu)https://github.com/Meowu
on Feb 21, 2020https://github.com/microsoft/TypeScript/issues/7014#issuecomment-589471953
https://github.com/okmttdhr
okmttdhr, tada (okmttdhr)https://github.com/okmttdhr
on Mar 31, 2020https://github.com/microsoft/TypeScript/issues/7014#issuecomment-606599556
https://github.com/SCWR
SCWR (SCWR)https://github.com/SCWR
on Sep 2, 2021https://github.com/microsoft/TypeScript/issues/7014#issuecomment-911135419
Seokrin Taron Sung (taronsung)https://github.com/taronsung
on Jan 29, 2026https://github.com/microsoft/TypeScript/issues/7014#event-22377029140
fix(lib): reorder Array#reduce/reduceRight overloads in lib.d.tshttps://github.com/taronsung/TypeScript/commit/9f609784a398d4a3c1e6aa5077d729a8ca3ac8f8
https://docs.github.com/articles/closing-issues-via-commit-messages
9f60978https://github.com/taronsung/TypeScript/commit/9f609784a398d4a3c1e6aa5077d729a8ca3ac8f8
fix(lib): reorder Array#reduce/reduceRight overloads in lib.d.tshttps://github.com/taronsung/TypeScript/commit/3efe7e121dbbdd8a26039770226b85dcce45ad93
https://docs.github.com/articles/closing-issues-via-commit-messages
3efe7e1https://github.com/taronsung/TypeScript/commit/3efe7e121dbbdd8a26039770226b85dcce45ad93
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Help Wantedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Help%20Wanted%22
Good First Issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Good%20First%20Issue%22
on Nov 10, 2026https://github.com/microsoft/TypeScript/issues/7014#event-35721598376
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/7014
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/7014
Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20lib.d.ts%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
BacklogNo due datehttps://github.com/microsoft/TypeScript/milestone/29
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.