Properly instantiate true type when extends type is any or unknown

This commit is contained in:
Anders Hejlsberg 2019-04-27 09:56:01 -07:00
parent 454b4280b1
commit 5a567ad56d

View file

@ -10383,7 +10383,7 @@ namespace ts {
// We attempt to resolve the conditional type only when the check and extends types are non-generic
if (!checkTypeInstantiable && !maybeTypeOfKind(inferredExtendsType, TypeFlags.Instantiable | TypeFlags.GenericMappedType)) {
if (inferredExtendsType.flags & TypeFlags.AnyOrUnknown) {
return trueType;
return instantiateType(root.trueType, combinedMapper || mapper);
}
// Return union of trueType and falseType for 'any' since it matches anything
if (checkType.flags & TypeFlags.Any) {