Skip to content

generics that extend conditional types that use another generic don't work #41743

Closed
@DetachHead

Description

@DetachHead

TypeScript Version: 4.2.0-dev.20201201

Search Terms:
Conditional types generics
Code

interface Foo<T, U extends T extends number? any: any> {}
function foo<T>(bar: Foo<T, number>) {}

Expected behavior:
No error, U is any
Actual behavior:
Error 2344: Type 'number' does not satisfy the constraint 'T extends number? any: any'
Playground Link:
https://www.typescriptlang.org/play?ts=4.2.0-dev.20201201#code/JYOwLgpgTgZghgYwgAgGIHt0B4AqAaZAVWQgA9IQATAZ2RxPIitpAFcBbAI2gH5k4QATwBc-IQD5kAbwC+AWABQMViARhg6EMhiZc4gBSc4UURmz5kbLtHEBKaTKA
Related Issues:
Maybe #41040 ?

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