Skip to content

[Bug] Generic type extending an Array can not be used as rest params #38767

Closed

Description

@bogdan

TypeScript Version: 3.9.3

Search Terms:

  • Rest element type
  • Generics

Code

type E<T extends any[]> = [...T]

Expected behavior:

No compilation error.

Actual behavior:

2574: A rest element type must be an array type.

Playground Link:

https://www.typescriptlang.org/play?#code/C4TwDgpgBAogPAFShAHsCA7AJgZygQwxAG0BdAPigF4piA6BhUgbgChWg

Activity

  1. ahejlsberg commented on May 25, 2020

    @ahejlsberg
    Member

    Duplicate of #26113.

  2. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions