Skip to content

Commit 1085e39

Browse files
committed
Always take the apparent type when you retrieve a contextual type
1 parent cd64f2b commit 1085e39

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/compiler/checker.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6442,6 +6442,11 @@ namespace ts {
64426442
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
64436443
// be "pushed" onto a node using the contextualType property.
64446444
function getContextualType(node: Expression): Type {
6445+
let type = getContextualTypeWorker(node);
6446+
return type && getApparentType(type);
6447+
}
6448+
6449+
function getContextualTypeWorker(node: Expression): Type {
64456450
if (isInsideWithStatementBody(node)) {
64466451
// We cannot answer semantic questions within a with block, do not proceed any further
64476452
return undefined;

0 commit comments

Comments
 (0)