From 5ab5cfd2fd444cf42cc1c56f8b96519644191385 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 4 Jan 2016 22:54:37 -0500 Subject: [PATCH] Contextually type the RHS of logical 'and' and comma expressions. --- src/compiler/checker.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c2e798659d..fb4af5d729 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7362,6 +7362,12 @@ namespace ts { } return type; } + else if (operator === SyntaxKind.AmpersandAmpersandToken || operator === SyntaxKind.CommaToken) { + if (node === binaryExpression.right) { + return getContextualType(binaryExpression); + } + } + return undefined; }