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 committed by Mohamed Hegazy
parent aee1bf6429
commit 5c11d4c349

View file

@ -13467,7 +13467,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);