Reproduction
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?
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too