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;