T extends unknown ? X : Y should eagerly resolve to X

This commit is contained in:
Anders Hejlsberg 2018-05-25 10:03:42 -07:00
parent ac6fa9ccee
commit 7247d8e33a

View File

@ -8984,6 +8984,9 @@ namespace ts {
if (checkType === wildcardType || extendsType === wildcardType) {
return wildcardType;
}
if (extendsType === getTopType()) {
return instantiateType(root.trueType, mapper);
}
// If this is a distributive conditional type and the check type is generic we need to defer
// resolution of the conditional type such that a later instantiation will properly distribute
// over union types.