Skip to content

Lib: args rest type should always be array of any #36327

Closed
@antongolub

Description

@antongolub

TypeScript Version: 3.8.0-dev.20200119

Search Terms: rest, ConstructorParameters, ReturnType
Code

/**
 * Obtain the parameters of a constructor function type in a tuple
 */
type ConstructorParameters<T extends new (...args: any) => any> = T extends new (...args: infer P) => any ? P : never;

Expected behavior:
...args rest param should extend any[]

Actual behavior:
...args has any type

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions