René's URL Explorer Experiment


Title: Function cannot be contextually typed when its rest parameter type is tuple type with leading rest elements · Issue #45972 · microsoft/TypeScript · GitHub

Open Graph Title: Function cannot be contextually typed when its rest parameter type is tuple type with leading rest elements · Issue #45972 · microsoft/TypeScript

X Title: Function cannot be contextually typed when its rest parameter type is tuple type with leading rest elements · Issue #45972 · microsoft/TypeScript

Description: Bug Report 🔎 Search Terms function rest arguments parameter tuple type leading middle rest elements 🕗 Version & Regression Information 4.2.3, 4.3.5, 4.4.2 I was unable to test this on prior versions because leading rest elements in tuple...

Open Graph Description: Bug Report 🔎 Search Terms function rest arguments parameter tuple type leading middle rest elements 🕗 Version & Regression Information 4.2.3, 4.3.5, 4.4.2 I was unable to test this on prior version...

X Description: Bug Report 🔎 Search Terms function rest arguments parameter tuple type leading middle rest elements 🕗 Version & Regression Information 4.2.3, 4.3.5, 4.4.2 I was unable to test this on prior ver...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Function cannot be contextually typed when its rest parameter type is tuple type with leading rest elements","articleBody":"# Bug Report\r\n\r\n\r\n### 🔎 Search Terms\r\n\r\nfunction rest arguments parameter tuple type leading middle rest elements\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n4.2.3, 4.3.5, 4.4.2\r\n\r\n\u003c!-- When did you start seeing this bug occur?\r\n\r\n\"Bugs\" that have existed in TS for a long time are very likely to be FAQs; refer to\r\n  https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs\r\n\r\nIf possible, please try testing the nightly version of TS to see if it's already been fixed.\r\nFor npm: `typescript@next`\r\nThis is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly\r\n\r\nNote: The TypeScript Playground can be used to try older versions of TypeScript.\r\n\r\nPlease keep and fill in the line that best applies:\r\n-->\r\n- I was unable to test this on prior versions because _leading rest elements in tuple types were introduced in TS 4.2_\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.4.2#code/C4TwDgpgBAYgrgOwMZQLxQBQDocEMBOA5gM4BcUA2jlscPmVLfgJYKEUC6ANFAnALYBGcn34AjCPh6iATCIET8HAJRoAfFABuAe2YATAFAGA9MagB5ANIGk2hLSgAzREnLxkaTKtQaA3gF8TMwBRfHxtfFIgqAAVcGgAcgwCQmFGOlZCKAAfXgVJbw0dfQSoZmJebWAoXGJiZkIEXDEAG2hgbShQSCgE9yQErGjY+IrtRygwAlx+CGBJCoSUwVLcBD1epmJV-GhWW34p4GZWiCHTKEuRnoSqHC3yJkzOaQE00UVX-jk88UkOUrlSrVWr1RrNNpdTrdRIUZaPDJsHK-RQA85mK6XADK2jg+CQ0AAFrUoDIoBA2rMEMAMMRVGI4NVgCk5jUWi1tAB3MYIFogKCCIa2ezVZzINL9TzJIiCQpQAJGC6hcKRaJxG7Swg-J5I3IfSQ8FIAZgRLF1KIK6i0uj0gIqCCqNTqDSapyhXXivX6g2G1wgYwmU3wMzmC16KRkq3Wmzo2xquzKyG0h1wx1O6Mxft6dxosdNz24v3e+Skvx++qUduBTrBrshHQ9NzhRG1iKyepLhqIJvSZvbFsrGczsRZIPZXJ5fNJ5MpEGptPpjMYuPx0H4uH5xM0a4iZxsdgcYqQP0l6E1Mi7hCNcoCAG5FSEwhEohd1YlNQAWfPmiuXgCs379r+8aEAAbIByIVnKxS2mU9qOqCLoQu00Ken0Lg+hclxvgGkzTLM8z0OGRAflGGwJFsOx7EmKZpm0Q5XG+2bUA8vYFl8xZ-KWsjyFxAJwdWiHgm6DYwtmKRfmxP6diBAFSUBMkpOB8mQSWaK+piMSjlAuwAI5wMwuwVEaM4QFSNJ0lADLVMQK4ElA66brg25OBAnKSEKB6ii4PanpgEn-peoE3v494GEAA)\r\n\r\n### 💻 Code\r\n\r\n\u003c!-- Please post the relevant code sample here as well-->\r\n```ts\r\ntype Func = (...args: [...strs: string[], num1: number, num2: number]) => void\r\n\r\n// OK\r\nconst func: Func = () => {}\r\n// Error:\r\n// Type '(arg1: string | number) => void' is not assignable to type 'Func'.\r\n//  Types of parameters 'arg1' and 'strs' are incompatible.\r\n//    Type '[...strs: string[], num1: number, num2: number]' is not assignable to type '[arg1: string | number]'.\r\n//      Source has 2 element(s) but target allows only 1.\r\nconst func1: Func = (arg1) => {}\r\n\r\n// Error:\r\n// Type '(arg2: string | number, arg3: string | number) => void' is not assignable to type 'Func'.\r\n//   Types of parameters 'arg2' and 'strs' are incompatible.\r\n//     Type '[...strs: string[], num1: number, num2: number]' is not assignable to type '[arg2: string | number, arg3: string | number]'.\r\n//       Target allows only 2 element(s) but source may have more.\r\nconst func2: Func = (arg2, arg3) => {};\r\n\r\n// Error:\r\n// Type '(arg4: string | number, arg5: string | number, arg6: string | number) => void' is not assignable to type 'Func'.\r\n//   Types of parameters 'arg4' and 'strs' are incompatible.\r\n//     Type '[...strs: string[], num1: number, num2: number]' is not assignable to type '[arg4: string | number, arg5: string | number, arg6: string | number]'.\r\n//       Target requires 3 element(s) but source may have fewer.\r\nconst func3: Func = (arg4, arg5, arg6) => {};\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\nFunctions that have one or more arguments (`func1`, `func2`, `func3`) cannot be assigned to variables of type `Func`.\r\n\r\n### 🙂 Expected behavior\r\n\r\nNo compiler errors and the types of arguments are inferred as:\r\n\r\n- `arg1`, `arg2`, `arg3`, `arg4`, `arg5`: `string | number`\r\n- `arg6`: `string | number | undefined`\r\n","author":{"url":"https://github.com/uhyo","@type":"Person","name":"uhyo"},"datePublished":"2021-09-20T17:07:58Z","url":"https://github.com/microsoft/TypeScript/issues/45972"}

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:7dab9272-73f3-7f30-2871-0aee4a4a7018
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEB8A:519AB:113DE4:189486:6B0464C6
html-safe-nonce2e6ab2e35ac7f93288aea167b5db3042baf55e520853bbc4ec82b342e70ce7db
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjhBOjUxOUFCOjExM0RFNDoxODk0ODY6NkIwNDY0QzYiLCJ2aXNpdG9yX2lkIjoiMTY4MDE2Nzg3MzQzMzMzMDg4NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacdd51f12c79363542b294c304b17d053fff130dc7e87ff2d6d8ae53ff38db5acf
hovercard-subject-tagissue:1001201252
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/45972/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e75ee8181ffe9a6dfedcd37a8a22bd475678a3051185a6a3d5b3af4b54b41db4/microsoft/TypeScript/issues/45972
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e75ee8181ffe9a6dfedcd37a8a22bd475678a3051185a6a3d5b3af4b54b41db4/microsoft/TypeScript/issues/45972
og:image:altBug Report 🔎 Search Terms function rest arguments parameter tuple type leading middle rest elements 🕗 Version & Regression Information 4.2.3, 4.3.5, 4.4.2 I was unable to test this on prior version...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameuhyo
hostnamegithub.com
expected-hostnamegithub.com
None83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f
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
releaseca4d07a7cef4e4b75f821dc25e7300d80c1450a9
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/45972#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F45972
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%2F45972
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/45972
Reloadhttps://github.com/microsoft/TypeScript/issues/45972
Reloadhttps://github.com/microsoft/TypeScript/issues/45972
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests319 (319)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
Function cannot be contextually typed when its rest parameter type is tuple type with leading rest elementshttps://github.com/microsoft/TypeScript/issues/45972#top
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featurehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Awaiting%20More%20Feedback%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com/uhyo
uhyo (uhyo)https://github.com/uhyo
on Sep 20, 2021https://github.com/microsoft/TypeScript/issues/45972#issue-1001201252
Playground link with relevant codehttps://www.typescriptlang.org/play?ts=4.4.2#code/C4TwDgpgBAYgrgOwMZQLxQBQDocEMBOA5gM4BcUA2jlscPmVLfgJYKEUC6ANFAnALYBGcn34AjCPh6iATCIET8HAJRoAfFABuAe2YATAFAGA9MagB5ANIGk2hLSgAzREnLxkaTKtQaA3gF8TMwBRfHxtfFIgqAAVcGgAcgwCQmFGOlZCKAAfXgVJbw0dfQSoZmJebWAoXGJiZkIEXDEAG2hgbShQSCgE9yQErGjY+IrtRygwAlx+CGBJCoSUwVLcBD1epmJV-GhWW34p4GZWiCHTKEuRnoSqHC3yJkzOaQE00UVX-jk88UkOUrlSrVWr1RrNNpdTrdRIUZaPDJsHK-RQA85mK6XADK2jg+CQ0AAFrUoDIoBA2rMEMAMMRVGI4NVgCk5jUWi1tAB3MYIFogKCCIa2ezVZzINL9TzJIiCQpQAJGC6hcKRaJxG7Swg-J5I3IfSQ8FIAZgRLF1KIK6i0uj0gIqCCqNTqDSapyhXXivX6g2G1wgYwmU3wMzmC16KRkq3Wmzo2xquzKyG0h1wx1O6Mxft6dxosdNz24v3e+Skvx++qUduBTrBrshHQ9NzhRG1iKyepLhqIJvSZvbFsrGczsRZIPZXJ5fNJ5MpEGptPpjMYuPx0H4uH5xM0a4iZxsdgcYqQP0l6E1Mi7hCNcoCAG5FSEwhEohd1YlNQAWfPmiuXgCs379r+8aEAAbIByIVnKxS2mU9qOqCLoQu00Ken0Lg+hclxvgGkzTLM8z0OGRAflGGwJFsOx7EmKZpm0Q5XG+2bUA8vYFl8xZ-KWsjyFxAJwdWiHgm6DYwtmKRfmxP6diBAFSUBMkpOB8mQSWaK+piMSjlAuwAI5wMwuwVEaM4QFSNJ0lADLVMQK4ElA66brg25OBAnKSEKB6ii4PanpgEn-peoE3v494GEAA
https://github.com/jcalz
Joe Calzaretta (jcalz)https://github.com/jcalz
on Sep 20, 2021https://github.com/microsoft/TypeScript/issues/45972#issuecomment-923215121
https://github.com/uhyo
uhyo (uhyo)https://github.com/uhyo
on Sep 21, 2021https://github.com/microsoft/TypeScript/issues/45972#issuecomment-923498423
Andrew Branch (andrewbranch)https://github.com/andrewbranch
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featurehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Awaiting%20More%20Feedback%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
on Sep 23, 2021https://github.com/microsoft/TypeScript/issues/45972#event-5352808102
https://github.com/graphemecluster
graphemecluster (graphemecluster)https://github.com/graphemecluster
on May 29, 2022https://github.com/microsoft/TypeScript/issues/45972#issuecomment-1140417029
Playground link with the above codehttps://www.typescriptlang.org/play?ts=4.7.0-beta#code/C4TwDgpgBAYgrgOwMZQLxQBQDocEMBOA5gM4BcUA2jlscPmVLfgJY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rfCtPM7DVOQv9FEIvYSLIvQZw4hT4nnBoTgARzgZgTlqD91wgBkmRZKA2QaYh9zJKAjxPXAzxcCABUkSVrxlNwPw8NxFWoF9CAAFnfIgAFZisIAA2b8Rxsj0J0w2y20suyiiIxyEHI4C-FAsCgA
Mateusz Burzyński (Andarist)https://github.com/Andarist
on Dec 28, 2022https://github.com/microsoft/TypeScript/issues/45972#event-8123522656
add tests from microsoft#45972https://github.com/Andarist/TypeScript/commit/beb241d9880a869469111912fcff53ab934a537b
microsoft#45972https://github.com/microsoft/TypeScript/issues/45972
beb241dhttps://github.com/Andarist/TypeScript/commit/beb241d9880a869469111912fcff53ab934a537b
https://github.com/Andarist
Mateusz Burzyński (Andarist)https://github.com/Andarist
on Dec 29, 2022https://github.com/microsoft/TypeScript/issues/45972#issuecomment-1367526598
#49218https://github.com/microsoft/TypeScript/pull/49218
#46063https://github.com/microsoft/TypeScript/issues/46063
uhyo (@uhyo)https://github.com/uhyo
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/45972
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/45972
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featurehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Awaiting%20More%20Feedback%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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.