Title: Remapped generic array type Can't pass to rest parameters · Issue #55932 · microsoft/TypeScript · GitHub
Open Graph Title: Remapped generic array type Can't pass to rest parameters · Issue #55932 · microsoft/TypeScript
X Title: Remapped generic array type Can't pass to rest parameters · Issue #55932 · microsoft/TypeScript
Description: 🔎 Search Terms rest parameters tuple array generic 🕗 Version & Regression Information I tried some versions from 3.3.3 to 5.2.2 and Nightly version 。none of them fixed this problem. ⏯ Playground Link https://www.typescriptlang.org/play?t...
Open Graph Description: 🔎 Search Terms rest parameters tuple array generic 🕗 Version & Regression Information I tried some versions from 3.3.3 to 5.2.2 and Nightly version 。none of them fixed this problem. ⏯ Playground Li...
X Description: 🔎 Search Terms rest parameters tuple array generic 🕗 Version & Regression Information I tried some versions from 3.3.3 to 5.2.2 and Nightly version 。none of them fixed this problem. ⏯ Playgroun...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/55932
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Remapped generic array type Can't pass to rest parameters","articleBody":"### 🔎 Search Terms\n\nrest parameters tuple array generic\n\n### 🕗 Version \u0026 Regression Information\n\n I tried some versions from 3.3.3 to 5.2.2 and Nightly version 。none of them fixed this problem.\r\n\r\n\n\n### ⏯ Playground Link\n\nhttps://www.typescriptlang.org/play?ts=5.2.2\u0026ssl=13\u0026ssc=119\u0026pln=1\u0026pc=1#code/ATAuE8AcFNgJWpANgQwMbQDwBVjQB6jQB2AJgM7ADaAdHSseALoA0wAgmwEIB8wAvMADeAWABQIEFQDSwAJbFgAa2jgA9gDNg2JgC5tMpnkIkKHYAH5gXYPuyGA3OJABfJ2OdgosBMnTQABRQAJxQAW3IcYyIySlp6RlZOXn4ACjoaEIBzcl1fVAxMKmIAVzCAI2hgllKKqqSWXgBKfh4GcAcAek65SjUlTwgYeEQCwJDw8gBGTHY4OHYATWjTOIz2hpT0+mCcvNH-WfmllmSeFrbGLs6NFDkkaFJzYOhyUGBICbDoImDgMJKb2AlWAmmADHBwVC4C8MBog28Iz8GCCoQiACYogQYmZtpldrp2hd2qdGjw0utdrl8odUeEflVItgeKTmq12g5gN1bvdHs9Xu9PmiGX8AUCQWCISFobDoPCPAqQEMfNAwihIDBSFiTLFqOtEnx+KIJJIZPJFCp1FodLp7NImJ4XAjhgBlORhZDQADCKHIWFw2NWeoSzENwDx2WpqvVmpw53ZV25dweT3YwBeQKF9N+-0B7wlWilUJQMOVNCAA\n\n### 💻 Code\n\n```ts\r\n type Replace\u003cT extends [...any], A, B\u003e = {\r\n [K in keyof T]: T[K] extends A ? B : T[K];\r\n };\r\n\r\n type ReplaceParams\u003cT extends [...any],A,B\u003e=(...args:Replace\u003c[number,number],A,B\u003e)=\u003eany;//is ok\r\n type ReplaceParams1\u003cARRAY extends [...any],A,B\u003e=(...args:Replace\u003cARRAY,A,B\u003e)=\u003eany;//failed A rest parameter must be of an array type.\r\n type ReplaceParams2\u003cT extends (...arg:any)=\u003eany,A,B\u003e=(...args:Replace\u003cParameters\u003cT\u003e,A,B\u003e)=\u003eany; //failed A rest parameter must be of an array type.\r\n\r\n\r\n type Remapped\u003cT extends [...any]\u003e ={\r\n [K in keyof T]:T[K]\r\n }\r\n type SimpleCase\u003cT extends [...any]\u003e = (...args:Remapped\u003cT\u003e)=\u003eany;//failed A rest parameter must be of an array type.\r\n```\r\n\n\n### 🙁 Actual behavior\n\nthis was happend at latest version [5.2.2](https://www.typescriptlang.org/play?ts=5.2.2\u0026ssl=13\u0026ssc=119\u0026pln=1\u0026pc=1#code/ATAuE8AcFNgJWpANgQwMbQDwBVjQB6jQB2AJgM7ADaAdHSseALoA0wAgmwEIB8wAvMADeAWABQIEFQDSwAJbFgAa2jgA9gDNg2JgC5tMpnkIkKHYAH5gXYPuyGA3OJABfJ2OdgosBMnTQABRQAJxQAW3IcYyIySlp6RlZOXn4ACjoaEIBzcl1fVAxMKmIAVzCAI2hgllKKqqSWXgBKfh4GcAcAek65SjUlTwgYeEQCwJDw8gBGTHY4OHYATWjTOIz2hpT0+mCcvNH-WfmllmSeFrbGLs6NFDkkaFJzYOhyUGBICbDoImDgMJKb2AlWAmmADHBwVC4C8MBog28Iz8GCCoQiACYogQYmZtpldrp2hd2qdGjw0utdrl8odUeEflVItgeKTmq12g5gN1bvdHs9Xu9PmiGX8AUCQWCISFobDoPCPAqQEMfNAwihIDBSFiTLFqOtEnx+KIJJIZPJFCp1FodLp7NImJ4XAjhgBlORhZDQADCKHIWFw2NWeoSzENwDx2WpqvVmpw53ZV25dweT3YwBeQKF9N+-0B7wlWilUJQMOVNCAA)\r\n\r\nand in the next version still no fixed\n\n### 🙂 Expected behavior\n\n quite sure tuple or array type can be passed to function rest pamaters. but remapped cant.this make replace certain type in parameters inpossible.\n\n### Additional information about the issue\n\n_No response_","author":{"url":"https://github.com/maxzhou0","@type":"Person","name":"maxzhou0"},"datePublished":"2023-10-01T16:19:20.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/55932/TypeScript/issues/55932"}
| 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:c8d7c733-b32e-93cf-5a42-4e2fc968110b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 96D8:1A1E86:25D1B5:3772FF:6A61E3CA |
| html-safe-nonce | 8f96191bf2571230838eca65c79a6a99d1b97e6c053a3ad8df97410d8aee8be5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NkQ4OjFBMUU4NjoyNUQxQjU6Mzc3MkZGOjZBNjFFM0NBIiwidmlzaXRvcl9pZCI6IjE3OTc2MDU0OTkyMDQ2NTgxMjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | eb13276c0c974425a8b512cfc7664a688bc16cb27b48eec65d8ef030f0b56f9a |
| hovercard-subject-tag | issue:1920847596 |
| 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/55932/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c712ebf8d307a17e4daf31020d9d48be9292b7c6c8ef56bf3ca2d53a16befaba/microsoft/TypeScript/issues/55932 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c712ebf8d307a17e4daf31020d9d48be9292b7c6c8ef56bf3ca2d53a16befaba/microsoft/TypeScript/issues/55932 |
| og:image:alt | 🔎 Search Terms rest parameters tuple array generic 🕗 Version & Regression Information I tried some versions from 3.3.3 to 5.2.2 and Nightly version 。none of them fixed this problem. ⏯ Playground Li... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | maxzhou0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b2de8c74e5e61e893155ba46ee41bc66170c1644cb795adefa8386d490f7781c |
| 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 | d1866027ded575df8a15c731dd8b9986c9483ceb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width