Skip to content

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

@Andarist

Description

@Andarist

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions