Don’t use checkExpressionCached when checking spread element inside a loop

This commit is contained in:
Andrew Branch committed 2019-04-24 14:15:58 -07:00
1 parent 48f038067e
commit 89497fcac9
6 files changed
+73 -5

No files matched your search

+1 -1
View File
@@ -20708,7 +20708,7 @@ namespace ts {
// of the argument is a tuple type, spread the tuple elements into the argument list. We can
// call checkExpressionCached because spread expressions never have a contextual type.
const spreadArgument = <SpreadElement>args[length - 1];
const type = checkExpressionCached(spreadArgument.expression);
const type = flowLoopCount ? checkExpression(spreadArgument.expression) : checkExpressionCached(spreadArgument.expression);
if (isTupleType(type)) {
const typeArguments = (<TypeReference>type).typeArguments || emptyArray;
const restIndex = type.target.hasRestElement ? typeArguments.length - 1 : -1;