Title: Contextual parameters not inferred from variadic tuples with trailing elements · Issue #52846 · microsoft/TypeScript · GitHub
Open Graph Title: Contextual parameters not inferred from variadic tuples with trailing elements · Issue #52846 · microsoft/TypeScript
X Title: Contextual parameters not inferred from variadic tuples with trailing elements · Issue #52846 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms tuple arguments trailing elements contextual type 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link Playground link with relevant code 💻 Code declare function tes...
Open Graph Description: Bug Report 🔎 Search Terms tuple arguments trailing elements contextual type 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link Playground link with r...
X Description: Bug Report 🔎 Search Terms tuple arguments trailing elements contextual type 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link Playground link wi...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/52846
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Contextual parameters not inferred from variadic tuples with trailing elements","articleBody":"# Bug Report\r\n\r\n### 🔎 Search Terms\r\n\r\ntuple arguments trailing elements contextual type\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This is the behavior in every version I tried\r\n\r\n### ⏯ Playground Link\r\n\r\n[Playground link with relevant code](https://www.typescriptlang.org/play?ts=5.0.0-dev.20230218#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXwxAGcMAKAKHngDpbYBzIgLngG1brTSGXVkBbAEYgYASngBeAHzwAbjizBRrALoAaeNxj0WJGFlT1x0uQuAryolvMUBucuUIkKVbsZkBvSlXhRvVAHoA+AA9AH5fTGQoCBYoVABPW3gQAA8AB3BCYF4BYRhvAF81b1JBd3gvH3hBf3gg0IioKJi4xOS0zMwQHPg+IREiktcwCqqfMDqG8MiMaNjfdpSMrJ7dDH1DIctbIA)\r\n\r\n### 💻 Code\r\n\r\n```ts\r\ndeclare function test(\r\n ...args: [...((arg: number) => void)[], (arg: string) => void]\r\n): void;\r\n\r\ntest(\r\n (a) => {\r\n a\r\n // ^? actual: any; expected: number\r\n },\r\n (b) => {\r\n b\r\n // ^? actual: any; expected: number\r\n },\r\n (c) => {\r\n c\r\n // ^? actual: any; expected: string\r\n },\r\n);\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\nContextual parameters can't be inferred.\r\n\r\n### 🙂 Expected behavior\r\n\r\nContextual parameters should be inferred.\r\n\r\n---\r\n\r\nQuoting @ahejlsberg from [here](https://github.com/microsoft/TypeScript/pull/52769#discussion_r1107765608):\r\n> This would require us to reason about elements at a fixed offset from the end of a tuple. We currently only reason about elements at a fixed offset from the start. It adds some more complexity, but it is certainly possible to do.","author":{"url":"https://github.com/Andarist","@type":"Person","name":"Andarist"},"datePublished":"2023-02-18T22:44:54Z","url":"https://github.com/microsoft/TypeScript/issues/52846"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d313a762-7531-6e5c-1212-9c0147425b6e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EAE8:19AA62:23EF60E:2DA1065:6B018399 |
| html-safe-nonce | 639dc55ca0ebc51b3d93a718f0e64afdf69de6e402c0d65913e3eede69b69007 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQUU4OjE5QUE2MjoyM0VGNjBFOjJEQTEwNjU6NkIwMTgzOTkiLCJ2aXNpdG9yX2lkIjoiMzQxOTMxNzk2ODMwNjI3NTIyNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d92964e61724f88962c664ff82034eeab4dd677c63e463f2a52b9353fdb92c83 |
| hovercard-subject-tag | issue:1590492337 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/52846/issue_layout |
| twitter:image | https://opengraph.githubassets.com/47fde403c27493c9a0fb1e7137e3a67bd48d9614eced2013e79cf0f4eeca1359/microsoft/TypeScript/issues/52846 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/47fde403c27493c9a0fb1e7137e3a67bd48d9614eced2013e79cf0f4eeca1359/microsoft/TypeScript/issues/52846 |
| og:image:alt | Bug Report 🔎 Search Terms tuple arguments trailing elements contextual type 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link Playground link with r... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Andarist |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width