Skip to content

Variadic element at position does not match element in target #53256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
awerlogus opened this issue Mar 14, 2023 · 0 comments · Fixed by #53672
Closed

Variadic element at position does not match element in target #53256

awerlogus opened this issue Mar 14, 2023 · 0 comments · Fixed by #53672
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@awerlogus
Copy link

awerlogus commented Mar 14, 2023

Bug Report

🔎 Search Terms

Tuple spread variadic element length

🕗 Version & Regression Information

Playground link with relevant code

💻 Code

function a <K extends [any]> () {
  // @ts-ignore Modifiers cannot appear here.(1184)
  declare const c1: [...K]

  // @ts-ignore Modifiers cannot appear here.(1184)
  declare const c2: [...K, ...K]

  // Ok
  const b1: [any] = c1

  // Type '[...K, ...K]' is not assignable to type '[any, any]'.
  //   Variadic element at position 0 in source does not match element at position 0 in target.(2322)
  const b2: [any, any] = c2
}

🙁 Actual behavior

c2 is not assignable to b2

🙂 Expected behavior

c2 is assignable to b2

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels Mar 14, 2023
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Mar 14, 2023
@ahejlsberg ahejlsberg self-assigned this Apr 7, 2023
@ahejlsberg ahejlsberg removed the Help Wanted You can do this label Apr 7, 2023
@ahejlsberg ahejlsberg modified the milestones: Backlog, TypeScript 5.1.0 Apr 7, 2023
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants