Skip to content

Regression when spreading Types in an Alias: TS1265: A rest element cannot follow another rest element. #57828

Description

@pfeileon

🔎 Search Terms

TS1265

🕗 Version & Regression Information

  • This changed between versions 5.3.3 and 5.4.2

⏯ Playground Link

https://www.typescriptlang.org/play?ts=5.4.2#code/MYewdgzgLgBAZgSwE7QPICMBWBTYsC8MA3nCCAFwwDkpIVAvjAIYQyiRQDcAUO9DBFzgAJhhx4YhIuiZJKVGUgbNWfLt17h+iFFADCWqEzAEYAbSpMANlaoAaGADpnACjG4ojgNbYAnhBcdNCwPAEpQgF0VNkMeNQEhMGEDDmNTC2tbB2dHNxC8bz8AwXZRfKhwqJYYjh5uKF8AB2wYADFkaAAVJpbCBuaQOHgO-UM0nn6WgGVE4W7myRhJwYTSlOhxjUmYAwBbdAQwbDmexaRsJmFwK19zbhgnZ3bdeew7e8fHGdLX94ieIA

💻 Code

constfirstObject={foo: 'foo'}asconst;constsecondObject={bar: 'bar'}asconst;constfirstConstant=['all', ...(Object.keys(firstObject))]asconst;constsecondConstant=['all', ...(Object.keys(secondObject))]asconst;typeFirstType=typeoffirstConstant;typeSecondType=typeofsecondConstant;typeCombinedType=readonly[
...FirstType,
...SecondType,];

Workbench Repro

🙁 Actual behavior

A rest element cannot follow another rest element.(1265)

🙂 Expected behavior

No error

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions