From 1085e39b9a489f82b65c8dfff0e303abdf9e27d8 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 2 Jul 2015 15:20:57 -0700 Subject: [PATCH] Always take the apparent type when you retrieve a contextual type --- src/compiler/checker.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d3d8ac1bc1b..65545efbcd2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6442,6 +6442,11 @@ namespace ts { // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. function getContextualType(node: Expression): Type { + let type = getContextualTypeWorker(node); + return type && getApparentType(type); + } + + function getContextualTypeWorker(node: Expression): Type { if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further return undefined;