Always take the apparent type when you retrieve a contextual type

This commit is contained in:
Jason Freeman
2015-07-02 15:20:57 -07:00
parent cd64f2b537
commit 1085e39b9a

View File

@@ -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;