Use 'true' and 'false' types when contextual type is 'boolean'

This commit is contained in:
Anders Hejlsberg
2016-08-27 09:50:23 -07:00
parent 65ef06edf4
commit dba310949f

View File

@@ -13464,7 +13464,7 @@ namespace ts {
return maybeTypeOfKind(contextualType, (TypeFlags.NumberLiteral | TypeFlags.EnumLiteral));
}
if (type.flags & TypeFlags.Boolean) {
return maybeTypeOfKind(contextualType, TypeFlags.BooleanLiteral) && !isTypeAssignableTo(booleanType, contextualType);
return maybeTypeOfKind(contextualType, TypeFlags.BooleanLiteral);
}
if (type.flags & TypeFlags.Enum) {
return typeContainsLiteralFromEnum(contextualType, <EnumType>type);