Ensure for-in loop variable is checked

This commit is contained in:
Ron Buckton
2018-08-15 16:03:28 -07:00
parent dfef227b18
commit a901930723
5 changed files with 92 additions and 2 deletions

View File

@@ -18321,7 +18321,7 @@ namespace ts {
return errorType;
}
const indexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : checkExpression(indexExpression);
const indexType = checkExpression(indexExpression);
if (objectType === errorType || objectType === silentNeverType) {
return objectType;
@@ -18332,7 +18332,7 @@ namespace ts {
return errorType;
}
return checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node);
return checkIndexedAccessIndexType(getIndexedAccessType(objectType, isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType, node), node);
}
function checkThatExpressionIsProperSymbolReference(expression: Expression, expressionType: Type, reportError: boolean): boolean {