René's URL Explorer Experiment


Title: Function inference fails when a final argument is supplied after rest via destructured tuples · Issue #43122 · microsoft/TypeScript · GitHub

Open Graph Title: Function inference fails when a final argument is supplied after rest via destructured tuples · Issue #43122 · microsoft/TypeScript

X Title: Function inference fails when a final argument is supplied after rest via destructured tuples · Issue #43122 · microsoft/TypeScript

Description: Bug Report I'm not sure whether inference failures are usually classified as suggestions or bugs. Sorry if I've assigned this the wrong label! 📖 Context / Introduction I'm trying to improve the typings for an open source library called r...

Open Graph Description: Bug Report I'm not sure whether inference failures are usually classified as suggestions or bugs. Sorry if I've assigned this the wrong label! 📖 Context / Introduction I'm trying to improve the typ...

X Description: Bug Report I'm not sure whether inference failures are usually classified as suggestions or bugs. Sorry if I've assigned this the wrong label! 📖 Context / Introduction I'm trying to imp...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Function inference fails when a final argument is supplied after rest via destructured tuples","articleBody":"# Bug Report\r\n\r\nI'm not sure whether inference failures are usually classified as suggestions or bugs. Sorry if I've assigned this the wrong label!\r\n\r\n### 📖 Context / Introduction\r\n\r\nI'm trying to improve the typings for an open source library called [reselect](https://github.com/reduxjs/reselect). Their `createSelector` function first takes in an arbitrary amount of \"selector\" functions that take in one parameter as a given state type, and then takes in one final additional function which combines the results of the previous functions. I have an implementation, but inference isn't working as I expect.\r\n\r\n### ⏯ Playground Link\r\n\r\n\u003c!--\r\n  A link to a TypeScript Playground \"Share\" link which shows this behavior\r\n\r\n  The TypeScript Workbench can be used for more complex setups, try\r\n  https://www.typescriptlang.org/dev/bug-workbench/\r\n\r\n  As a last resort, you can link to a repo, but these will be slower for us to investigate.\r\n-->\r\n[Playground link with relevant code](https://www.typescriptlang.org/play?ts=4.2.2#code/KYDwDg9gTgLgBDAnmYcDKwA2wDGNoA8aMAhjMAHxwC8cAFAM6nkBc6zwAlDVQK4B2Aa34QA7vwDcAKFCRYCZKgzY80ACq8w2Ihyq1lufFB1lKAbQC60meGjwkKOAFEQJALZbgxUzTgBvKTg4ADMICDYAIlCICOkggCMSKDYAFgAmaQBfa1k7EIE8AEsIfjgcKGBTA1VjNDhQcn4AEwZ0LEN1TW0Xd09vcgoKOkC4ADpxhnaahjYzcdHJlSMZ9AAaELY6EDYSfkRuaipdxAs4AHozkLKSXknWwoYGXmAGKW4AoJwShghsUcwIABzRhTZacLJSKTlSrkapGYZBLYHKggUbRdYXOAgOAPOAQYJwADkx0JCkcUDIAAtgFAEJTds5XB5sP1gCMkTwsaNElAMZdsbj8USSWTUBSYNTaRKGT1mV4OOzkXB0m9pEA)\r\n\r\n### 💻 Code\r\n```ts\r\nexport type Selector\u003cState> = (state: State) => unknown;\r\nexport type SelectorTuple\u003cState> = Selector\u003cState>[];\r\n\r\nexport type ExampleState = {\r\n  foo: \"foo\";\r\n  bar: 42;\r\n};\r\n\r\nexport function createSelector\u003cS extends SelectorTuple\u003cExampleState>>(\r\n  ...selectors: [...selectors: S, f: (x: any) => any] // f causes issues\r\n) {\r\n  console.log(selectors);\r\n}\r\n\r\ncreateSelector(\r\n  (x) => x.foo, // x is of 'any' type rather than ExampleState\r\n  (x) => x.bar, // x is of 'any' type rather than ExampleState\r\n  () => 42\r\n);\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\nIn the `createSelector` call, all of the `x` parameters have an implicit type of `any`, instead of `ExampleState`.\r\n\r\nObservations:\r\n* When the last tuple element is removed from the type, inference works.\r\n* When the last tuple element is made to have zero parameters, inference works.\r\n* When the last tuple element is made to be anything except a function or `any`, inference works.\r\n\r\nFor some reason, the compiler is having difficulty inferring the rest parameters in this case.\r\n\r\n### 🙂 Expected behavior\r\n\r\nI would expect the type system to infer that the `x` parameter of all functions except the last is `ExampleState`.","author":{"url":"https://github.com/poteat","@type":"Person","name":"poteat"},"datePublished":"2021-03-07T00:18:57Z","url":"https://github.com/microsoft/TypeScript/issues/43122"}

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:92be002a-d4f9-7968-303b-d8c74d075393
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD886:317608:27C661E:32556D7:6B019461
html-safe-nonced2ec65fee095da918b6d1ed75e6a916725ec066d3717ac708c2cc902a6cb3d6a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODg2OjMxNzYwODoyN0M2NjFFOjMyNTU2RDc6NkIwMTk0NjEiLCJ2aXNpdG9yX2lkIjoiNzY2ODEzNzkwNTU2NzU1MDQxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3668dd8e3bc24f28b0f9a6456252dfa74a9db67614aebdc52f3b0cae0d7c1e85
hovercard-subject-tagissue:823786295
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/43122/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1eab868dcb57cbfbde891b48b8a6165077a355d8b65577ecf0f8a89cef502ee1/microsoft/TypeScript/issues/43122
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1eab868dcb57cbfbde891b48b8a6165077a355d8b65577ecf0f8a89cef502ee1/microsoft/TypeScript/issues/43122
og:image:altBug Report I'm not sure whether inference failures are usually classified as suggestions or bugs. Sorry if I've assigned this the wrong label! 📖 Context / Introduction I'm trying to improve the typ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepoteat
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/43122#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F43122
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%2F43122
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/43122
Reloadhttps://github.com/microsoft/TypeScript/issues/43122
Reloadhttps://github.com/microsoft/TypeScript/issues/43122
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests312 (312)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/43122
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/43122
#53036https://github.com/microsoft/TypeScript/pull/53036
Function inference fails when a final argument is supplied after rest via destructured tupleshttps://github.com/microsoft/TypeScript/issues/43122#top
#53036https://github.com/microsoft/TypeScript/pull/53036
https://github.com/ahejlsberg
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
RescheduledThis issue was previously scheduled to an earlier milestonehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Rescheduled%22
TypeScript 5.1.0https://github.com/microsoft/TypeScript/milestone/178
https://github.com/poteat
Alice T'Poteat (poteat)https://github.com/poteat
on Mar 7, 2021https://github.com/microsoft/TypeScript/issues/43122#issue-823786295
reselecthttps://github.com/reduxjs/reselect
Playground link with relevant codehttps://www.typescriptlang.org/play?ts=4.2.2#code/KYDwDg9gTgLgBDAnmYcDKwA2wDGNoA8aMAhjMAHxwC8cAFAM6nkBc6zwAlDVQK4B2Aa34QA7vwDcAKFCRYCZKgzY80ACq8w2Ihyq1lufFB1lKAbQC60meGjwkKOAFEQJALZbgxUzTgBvKTg4ADMICDYAIlCICOkggCMSKDYAFgAmaQBfa1k7EIE8AEsIfjgcKGBTA1VjNDhQcn4AEwZ0LEN1TW0Xd09vcgoKOkC4ADpxhnaahjYzcdHJlSMZ9AAaELY6EDYSfkRuaipdxAs4AHozkLKSXknWwoYGXmAGKW4AoJwShghsUcwIABzRhTZacLJSKTlSrkapGYZBLYHKggUbRdYXOAgOAPOAQYJwADkx0JCkcUDIAAtgFAEJTds5XB5sP1gCMkTwsaNElAMZdsbj8USSWTUBSYNTaRKGT1mV4OOzkXB0m9pEA
https://github.com/mkantor
Matt Kantor (mkantor)https://github.com/mkantor
on Mar 7, 2021https://github.com/microsoft/TypeScript/issues/43122#issuecomment-792137094
Playgroundhttps://www.typescriptlang.org/play?ts=4.2.2#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXxAA8oBbABwhAAoA6O2AcwGcAueAbTpqqtTdWQkARiBgBKeAF4AfPABuOLMDHsAugBp4VQmyioAnhJnzFwVWLYKlAKCKkK1a-HiEpswjUQ4cmgPS+XeCwmeD19eBgoDAALUXgYvXgBYVEnQOMPIVg-ANdg0IMIqNiYeOjE5JEYNNcMmiyALxzA-LAcGDhMCHCw+BKQTSFkDCScAElyCCwwLAwAQUL8rHR2zoxu+DbJqGXlhmsxIA
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
on Mar 8, 2021https://github.com/microsoft/TypeScript/issues/43122#event-4422961337
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
on Mar 8, 2021https://github.com/microsoft/TypeScript/issues/43122#event-4422961535
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.3.1https://github.com/microsoft/TypeScript/milestone/138
on Mar 8, 2021https://github.com/microsoft/TypeScript/issues/43122#event-4422961708
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
RescheduledThis issue was previously scheduled to an earlier milestonehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Rescheduled%22
on Jun 18, 2021https://github.com/microsoft/TypeScript/issues/43122#event-4910917203
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.3.1https://github.com/microsoft/TypeScript/milestone/138
TypeScript 4.4.1 (RC)https://github.com/microsoft/TypeScript/milestone/144
on Jun 18, 2021https://github.com/microsoft/TypeScript/issues/43122#event-4910934717
Andrew Branch (andrewbranch)https://github.com/andrewbranch
TypeScript 4.4.1 (RC)https://github.com/microsoft/TypeScript/milestone/144
TypeScript 4.5.0https://github.com/microsoft/TypeScript/milestone/147
on Aug 31, 2021https://github.com/microsoft/TypeScript/issues/43122#event-5229243509
https://github.com/JensDll
Jens Döllmann (JensDll)https://github.com/JensDll
on Oct 22, 2021https://github.com/microsoft/TypeScript/issues/43122#issuecomment-949576239
Playgroundhttps://www.typescriptlang.org/play?ts=4.4.4#code/C4TwDgpgBAglC8UAUBDAXFAdgVwLYCMIAnASgQD4s9CiAoUSKAIQWXwwGdgiBLTAczLxKXXgNr1w0ACqsA2jAA0VAsQC6UAD5Q5TZaL781EgMYB7TFyjAAjBlmI5ADwpQnygCwAmY+cvBrL3t5F2E3ZQByCOMgA
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.5.0https://github.com/microsoft/TypeScript/milestone/147
TypeScript 4.6.0https://github.com/microsoft/TypeScript/milestone/151
on Dec 15, 2021https://github.com/microsoft/TypeScript/issues/43122#event-5768059587
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.6.0https://github.com/microsoft/TypeScript/milestone/151
TypeScript 4.6.1https://github.com/microsoft/TypeScript/milestone/158
on Feb 3, 2022https://github.com/microsoft/TypeScript/issues/43122#event-6005686092
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.6.1https://github.com/microsoft/TypeScript/milestone/158
TypeScript 4.8.0https://github.com/microsoft/TypeScript/milestone/163
on May 13, 2022https://github.com/microsoft/TypeScript/issues/43122#event-6607997393
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.8.0https://github.com/microsoft/TypeScript/milestone/163
TypeScript 5.1.0https://github.com/microsoft/TypeScript/milestone/178
on Feb 1, 2023https://github.com/microsoft/TypeScript/issues/43122#event-8413663965
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Mar 1, 2023https://github.com/microsoft/TypeScript/issues/43122#event-8632750434
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#53036https://github.com/microsoft/TypeScript/pull/53036
on Mar 19, 2023https://github.com/microsoft/TypeScript/issues/43122#event-8788030427
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/43122
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/43122
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
RescheduledThis issue was previously scheduled to an earlier milestonehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Rescheduled%22
TypeScript 5.1.0https://github.com/microsoft/TypeScript/milestone/178
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.