Merge pull request #14195 from HerringtonDarkholme/object-iteration

fix #14187, forIn should allow non primitive object as right hand side
This commit is contained in:
Mohamed Hegazy authored and GitHub committed 2017-03-23 10:11:50 -07:00
commit 87c291eb2f
12 files changed
+128 -1

No files matched your search

+1 -1
View File
@@ -18788,7 +18788,7 @@ namespace ts {
// unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved
// in this case error about missing name is already reported - do not report extra one
if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeVariable)) {
if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeVariable | TypeFlags.NonPrimitive)) {
error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);
}