Title: Variadic tuple assignment fail · Issue #49138 · microsoft/TypeScript · GitHub
Open Graph Title: Variadic tuple assignment fail · Issue #49138 · microsoft/TypeScript
X Title: Variadic tuple assignment fail · Issue #49138 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms variadic tuple bug 🕗 Version & Regression Information The same behavior is visible from 4.2.3 through 4.8dev although it it as only been a bug since variadic tuples. ⏯ Playground Link Playground link with releva...
Open Graph Description: Bug Report 🔎 Search Terms variadic tuple bug 🕗 Version & Regression Information The same behavior is visible from 4.2.3 through 4.8dev although it it as only been a bug since variadic tuples. ⏯ Pla...
X Description: Bug Report 🔎 Search Terms variadic tuple bug 🕗 Version & Regression Information The same behavior is visible from 4.2.3 through 4.8dev although it it as only been a bug since variadic tuples. ⏯...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/49138
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Variadic tuple assignment fail ","articleBody":"# Bug Report\r\n\r\n### 🔎 Search Terms\r\n\r\nvariadic tuple bug \r\n\r\n\r\n### 🕗 Version & Regression Information\r\n\r\nThe same behavior is visible from 4.2.3 through 4.8dev\r\nalthough it it as only been a bug since variadic tuples. \r\n\r\n### ⏯ Playground Link\r\n\r\n[Playground link with relevant code](https://www.typescriptlang.org/play?#code/PTAEBUAsFMGdtLSB7ArgGwCagEYIPIDSiAlgHYDGCAbgIYBOJtmJFoALqgA7pygAU9OO1AVaZUAHNkocQE8A7jCEBKAFAhQ1aPVglkZWKAAsAOgBMpgMygAfidMAOUJmjVTagN5rQvjnK4EcABGc1AAXlAAbQAiAD0YgBpQU1T+WHZGMklQAB9cZGRecTzQVDJXADNyaEwVKIBdZJiAEhiGnz8KAwyOUNoALhCwyNiE5raGgG4-WdBNAGUUDGwyZBE8WQkdemR6Tt9uwxF2UJwh0Ijo+KSOelRoCfaZ+bAltCxQNY2EEp29tQAXzUQA)\r\n\r\n### 💻 Code\r\n\r\n\r\n```ts\r\n// These should be OK since variadic tuples (rest can go anywhere)\r\n// versions 4.2.3 ~ 4.8 dev.\r\n{\r\n type T12 = [\"^\", ...(string | boolean | undefined)[], \"$\"]\r\n const t12a:T12 = [\"^\", \"$\"]; // Should not be an error\r\n const t12b:T12 = [\"^\", true, \"$\"]; // Should not be an error\r\n}\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\nAs shown. \r\n\r\n### 🙂 Expected behavior\r\n\r\nNot errors, because a match exists. \r\n\r\n### Additional Info\r\n\r\nI examined the code. `checkArrayLiteral` in `checker.ts` performs a unidirection (left to right) search only,\r\n\r\nHowever, the output from `createNormalizedTupleType` outputs a normalized type that can have a single tuple in the middle (like the one in the example).\r\n\r\nThat requires a bidirectional search to get the right results.\r\n\r\nAlternatively, `createNormalizedTupleType` could be forced to roll up everything after the first rest into a single rest. But such an algorithm would result in more false postives (false passes) than necessary. So a bidirectional search is preferable.\r\n\r\nI can provide more details if necessary. (I even have bi-directional search code that passes all the baselines tests). Just ask if you want it.\r\n\r\n\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/craigphicks","@type":"Person","name":"craigphicks"},"datePublished":"2022-05-16T21:25:09Z","url":"https://github.com/microsoft/TypeScript/issues/49138"}
| 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:2c62fc07-d57c-bb30-89ab-37787525c6e2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B0A2:2E5652:26D5D98:316E380:6B0197B8 |
| html-safe-nonce | 0605dd2583e52401526a27a45ee216d403f8368e891ae00e5c2434f78d2ced0e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEEyOjJFNTY1MjoyNkQ1RDk4OjMxNkUzODA6NkIwMTk3QjgiLCJ2aXNpdG9yX2lkIjoiNDA2MTgyODYyOTMzNTYzMzIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3e2ff0523dfe839272bdb48f92c2dbfeaa582880c097300dce6f3e8dd069ec27 |
| hovercard-subject-tag | issue:1237742205 |
| 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/49138/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d8662748d1b59b33e6754c8165ed50d06089edb20b18fbfafedaa5b68de533f6/microsoft/TypeScript/issues/49138 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d8662748d1b59b33e6754c8165ed50d06089edb20b18fbfafedaa5b68de533f6/microsoft/TypeScript/issues/49138 |
| og:image:alt | Bug Report 🔎 Search Terms variadic tuple bug 🕗 Version & Regression Information The same behavior is visible from 4.2.3 through 4.8dev although it it as only been a bug since variadic tuples. ⏯ Pla... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | craigphicks |
| 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