Skip to content

Generic type constraint does not apply to rest parameters #2328

Closed
@sccolbert

Description

@sccolbert

The following fails to compile even though T is constrained to an array type:

function attach<T extends any[]>(cb: (...args: T) => void): void { }
A rest parameter must be of an array type.
(parameter) args: T extends any[]

Metadata

Metadata

Assignees

No one assigned

    Labels

    By DesignDeprecated - use "Working as Intended" or "Design Limitation" instead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions