Skip to content

Commit

Permalink
Properly instantiate true type when extends type is any or unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed Apr 27, 2019
1 parent 454b428 commit 5a567ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Expand Up @@ -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) {
Expand Down

0 comments on commit 5a567ad

Please sign in to comment.