Merge pull request #3724 from Microsoft/apparentTypeOfContextualType

Always get the apparent type when retrieving a contextual type
This commit is contained in:
Jason Freeman
2015-07-06 10:18:21 -07:00
21 changed files with 391 additions and 36 deletions

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;