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
2017-03-23 10:11:50 -07:00
committed by GitHub
12 changed files with 128 additions and 1 deletions

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);
}