Title: Rest declarations in destructured arrays receiving incorrect types from tuples declaring the types in the destructured array · Issue #16700 · microsoft/TypeScript · GitHub
Open Graph Title: Rest declarations in destructured arrays receiving incorrect types from tuples declaring the types in the destructured array · Issue #16700 · microsoft/TypeScript
X Title: Rest declarations in destructured arrays receiving incorrect types from tuples declaring the types in the destructured array · Issue #16700 · microsoft/TypeScript
Description: TypeScript Version: 2.3.4 Code public async action([res, commandName, ...roleNames]: [ResourceLoader, string, string[]]): Promise
Open Graph Description: TypeScript Version: 2.3.4 Code public async action([res, commandName, ...roleNames]: [ResourceLoader, string, string[]]): Promise
X Description: TypeScript Version: 2.3.4 Code public async action([res, commandName, ...roleNames]: [ResourceLoader, string, string[]]): Promise<void> { ... } Expected behavior: When destructuring the metho...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/16700
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Rest declarations in destructured arrays receiving incorrect types from tuples declaring the types in the destructured array","articleBody":"\u003c!-- BUGS: Please use this template. -->\r\n\u003c!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->\r\n\u003c!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->\r\n\r\n**TypeScript Version:** 2.3.4\r\n\r\n**Code**\r\n\r\n```ts\r\npublic async action([res, commandName, ...roleNames]: [ResourceLoader, string, string[]]): Promise\u003cvoid> { ... }\r\n```\r\n\r\n**Expected behavior:**\r\nWhen destructuring the method parameter (which can be an array of potentially anything after middleware has had its say, but I know exactly what it will be in this case) I've gathered the remaining array values (which I know to be strings) into `roleNames` and declared the type of the variables in the destructured array via the tuple `[ResourceLoader, string, string[]]`.\r\n\r\nI expect `roleNames` to take on the declared type from the tuple as `res` and `commandName` have correctly done.\r\n\r\n**Actual behavior:**\r\nWhen hovering over the `roleNames` declaration I get the following:\r\n```ts\r\nvar roleNames: (string | ResourceLoader | string[])[]\r\n```\r\n\r\nApologies for the convoluted title. Couldn't think of a less verbose description.","author":{"url":"https://github.com/zajrik","@type":"Person","name":"zajrik"},"datePublished":"2017-06-22T20:55:05Z","url":"https://github.com/microsoft/TypeScript/issues/16700"}
| 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:6e61a618-9359-6887-b072-7e0695b08d9d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8582:B53AF:A53184:DD74F1:6B00ED3B |
| html-safe-nonce | ddec6115601afd2fe904317d3f1b0a54a94bac1954c9c1e2c229d97d49932f9f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTgyOkI1M0FGOkE1MzE4NDpERDc0RjE6NkIwMEVEM0IiLCJ2aXNpdG9yX2lkIjoiMjkzODg3MDY5NDUwODgxNzcyNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5e3d616537e8da83235feffb2b28a9cbdfa58c3b8b99cc2465e5417bbcf9256d |
| hovercard-subject-tag | issue:237971205 |
| 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/16700/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e4e0895e841375ba51cb7626d64b419ea40e7be637abb5094ae72d5e1a007f60/microsoft/TypeScript/issues/16700 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e4e0895e841375ba51cb7626d64b419ea40e7be637abb5094ae72d5e1a007f60/microsoft/TypeScript/issues/16700 |
| og:image:alt | TypeScript Version: 2.3.4 Code public async action([res, commandName, ...roleNames]: [ResourceLoader, string, string[]]): Promise |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zajrik |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width