Make getContextualTypeOfApparentType mapType over unions (#17668)

* Instantiate contextual types while in an inferrential context

* Limit scope of instantiation to only when likely needed

* Still get aparent type

* Expand test

* Fix nit

* Handle JSX and array

* Tests for the JSX and Array cases

* After much deliberation and inspection, much simpler fix

After much deliberation and inspection, much simpler fix

Undo

Redo
This commit is contained in:
Wesley Wigham
2017-11-06 12:52:33 -08:00
committed by GitHub
parent 4f48bf80fe
commit 0593ba27d8
6 changed files with 757 additions and 1 deletions

View File

@@ -13691,7 +13691,7 @@ namespace ts {
// be "pushed" onto a node using the contextualType property.
function getApparentTypeOfContextualType(node: Expression): Type {
const type = getContextualType(node);
return type && getApparentType(type);
return type && mapType(type, getApparentType);
}
/**