Skip to content
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

Variadic tuple with any[] spread incorrectly assignable to shorter variadic tuple target #50216

Closed
Andarist opened this issue Aug 8, 2022 · 0 comments Β· Fixed by #50218
Closed
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@Andarist
Copy link
Contributor

Andarist commented Aug 8, 2022

Bug Report

πŸ”Ž Search Terms

variadic, tuple, any, assignable

πŸ•— Version & Regression Information

  • This changed between versions 4.1.5 and 4.2.x, it's probably a regression from this PR

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

declare let tt3: [number, string, ...any[]];
let tt4: [number, ...number[]] = tt3; // it should error

const el = tt4[1]
//    ^? number
tt4[1] = tt3[1] // this errors correctly

πŸ™ Actual behavior

Unsound assignment is incorrectly allowed

πŸ™‚ Expected behavior

It should be a type error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
2 participants