Closed
Description
Bug Report
π Search Terms
any, alias, conditional type,
π Version & Regression Information
All versions are effected.
β― Playground Link
π» Code
interface User {
id: number;
username: string;
}
type Q<T> = {a: keyof T & string };
type t1 = Q<any> extends Q<User> ? true : never;
type qAny = Q<any>;
type t2 = qAny extends Q<User> ? true : never;
π Actual behavior
t1
is true, and t2
is never.
π Expected behavior
Both, t1
and t2
should be the same and be never
, because {a: string} extends {a: 'id' | 'username'}
is false.
The only difference is that the left value of extends is for t2
an alias, but the same type as in t1
.
Interesting might be that t2
was in v4.1 true
as well, but started to get the right value in v4.2.
Maybe related to #31295