We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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 ?
U
any
Type 'number' does not satisfy the constraint 'T extends number? any: any'
TypeScript Version: 4.2.0-dev.20201201
Search Terms:
Conditional types generics
Code
Expected behavior:
No error,
UisanyActual 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 ?