Support comma operator in type guards

This commit is contained in:
Anders Hejlsberg
2016-04-20 06:59:28 -07:00
parent c8bf6d821a
commit ea96dfd364
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -630,6 +630,8 @@ namespace ts {
return false;
case SyntaxKind.InstanceOfKeyword:
return isNarrowingExpression(expr.left);
case SyntaxKind.CommaToken:
return isNarrowingExpression(expr.right);
}
return false;
}
+2
View File
@@ -7677,6 +7677,8 @@ namespace ts {
break;
case SyntaxKind.InstanceOfKeyword:
return narrowTypeByInstanceof(type, expr, assumeTrue);
case SyntaxKind.CommaToken:
return narrowType(type, expr.right, assumeTrue);
}
return type;
}