Support comma operator in type guards

This commit is contained in:
Anders Hejlsberg committed 2016-04-20 06:59:28 -07:00
1 parent c8bf6d821a
commit ea96dfd364
2 files changed
+4

No files matched your search

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