Skip to content

Spreads instantiated with array subtypes types exhibit bad behavior #26110

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

Found by playing around with @mattmccutchen's example at #26013 (comment):

interface CoolArray<E> extends Array<E> { 
    hello: number;
}

declare function foo<T extends any[]>(cb: (...args: T) => void): void;

foo<CoolArray<any>>();    // error
foo<CoolArray<any>>(100); // error
foo<CoolArray<any>>(foo); // no error!!

Expected: All of these calls produce an error and have a good error message.
Actual: The first two have bad errors, the last one is considered okay.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions