Skip to content

Commit 537d878

Browse files
committed
Change getTypeOfNode to take an apparentType flag
1 parent 6b778f1 commit 537d878

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6820,9 +6820,9 @@ module ts {
68206820
return undefined;
68216821
}
68226822

6823-
function getTypeOfNode(node: Node): Type {
6823+
function getTypeOfNode(node: Node, apparentType: boolean): Type {
68246824
if (isExpression(node)) {
6825-
return getTypeOfExpression(<Expression>node);
6825+
return getTypeOfExpression(<Expression>node, apparentType);
68266826
}
68276827
if (isTypeNode(node)) {
68286828
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName) {
@@ -6863,11 +6863,12 @@ module ts {
68636863
Debug.fail("Unhandled case in getTypeOfNode");
68646864
}
68656865

6866-
function getTypeOfExpression(expr: Expression): Type {
6866+
function getTypeOfExpression(expr: Expression, apparentType: boolean): Type {
68676867
if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) {
68686868
expr = expr.parent;
68696869
}
6870-
return <Type>getApparentType(checkExpression(expr));
6870+
var type = checkExpression(expr);
6871+
return apparentType ? getApparentType(type) : type;
68716872
}
68726873

68736874
function getAugmentedPropertiesOfApparentType(type: Type): Symbol[]{

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ module ts {
604604
getReturnTypeOfSignature(signature: Signature): Type;
605605
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
606606
getSymbolInfo(node: Node): Symbol;
607-
getTypeOfNode(node: Node): Type;
607+
getTypeOfNode(node: Node, apparentType: boolean): Type;
608608
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
609609
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
610610
getAugmentedPropertiesOfApparentType(type: Type): Symbol[];

src/services/services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ module ts {
16931693

16941694
// Right of dot member completion list
16951695
if (isRightOfDot) {
1696-
var type: Type = typeInfoResolver.getTypeOfNode(mappedNode);
1696+
var type: Type = typeInfoResolver.getTypeOfNode(mappedNode, /*apparentType*/ true);
16971697
if (!type) {
16981698
return undefined;
16991699
}

0 commit comments

Comments
 (0)