type Generic<Type extends string> = Type;
type GenericInstance = Generic<any>;
type T1 = GenericInstance extends Generic<infer T> ? T : never; // any
type T2 = IsAny<T1>; // true, as it should be
type T3 = GenericInstance extends Generic<infer T> ? IsAny<T> : never; // false, but should be true
// I guess the second inference removes references to the type being a string?
type T4 = GenericInstance extends Generic<infer T> ? IsAny<T extends (infer TT) ? TT : never> : never; // true, as it should be
My wild guess is that it has something to do with the generic constraint <Type extends string> and the returned any is still seen as some sort of string in this case, might be a TS bug?
Upvote & Fund
We're using Polar.sh so you can upvote and help fund this issue.
The funding will be given to active contributors.
Thank you in advance for helping prioritize & fund our backlog.
Reproduction
My wild guess is that it has something to do with the generic constraint
<Type extends string>
and the returnedany
is still seen as some sort ofstring
in this case, might be a TS bug?Upvote & Fund