Skip to content

「Bug」multiple candidates for the same type variable in contra-variant positions causes an intersection type to be inferred #34732

Closed
@ghost

Description

According to the #21496 PR, there should be string & number expected results

type Bar<T> = T extends { a: (x: infer U) => void; b: (x: infer U) => void } ? U : never;
type T20 = Bar<{ a: (x: string) => void; b: (x: string) => void }>; // string
type T21 = Bar<{ a: (x: string) => void; b: (x: number) => void }>; // string & number

However, under ts version 3.6.4, the results are not as expected

QQ20191025-163119.png

QQ20191025-163934.png

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