diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 6eefd7c6ef9..91f4247a673 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -630,6 +630,8 @@ namespace ts { return false; case SyntaxKind.InstanceOfKeyword: return isNarrowingExpression(expr.left); + case SyntaxKind.CommaToken: + return isNarrowingExpression(expr.right); } return false; } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4731046864e..09d70ac3684 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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; }