Skip to content

Type inferred within a transitive constraint composition does not satisfy the constraint #34604

@ackvf

Description

@ackvf

TypeScript Version: 3.6.3, 3.7-Beta

Code

type AnyFunction = (...args: any[]) => any;

type ExtractSomething<T extends AnyFunction> = never

type ExtractSomethings<T extends AnyFunction[]> = 
  T extends Array<infer U>
    ? ExtractSomething<U> // Type 'U' does not satisfy the constraint 'AnyFunction'
    : never

Expected behavior:
Inferred array element from a constrained array generic should pass the same constraint again.

Actual behavior:

Type 'U' does not satisfy the constraint 'AnyFunction'. (2344)

Playground Link: : http://www.typescriptlang.org/play/?ts=3.7-Beta#code/C4TwDgpgBAggdiAYgVzgY2ASwPZygXigAoA6MgQwCcBzAZwC4pyEBtAXQEoCA+JhAbgCwAKBGhIUAKIAPYJXIYAytgC2EYAAtMcagB4AKlAiyIcACa1YCFOiy5ehOBABuESiLHhoMuQuDK1TW06AyMTc0t4JFQMHDh2BygRKChDY2BTC1hKeRBdbQAzNygAVW5klKgAfilZeSVVdS0dXTKKlMYnV0ogA

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