Skip to content

Commit d9c9129

Browse files
committed
Ignore references in with statements in getTypeOfDottedName
1 parent 6d6c620 commit d9c9129

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/compiler/checker.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16945,18 +16945,20 @@ namespace ts {
1694516945
// parameter symbols with declarations that have explicit type annotations. Such references are
1694616946
// resolvable with no possibility of triggering circularities in control flow analysis.
1694716947
function getTypeOfDottedName(node: Expression): Type | undefined {
16948-
switch (node.kind) {
16949-
case SyntaxKind.Identifier:
16950-
const symbol = getResolvedSymbol(<Identifier>node);
16951-
return getExplicitTypeOfSymbol(symbol.flags & SymbolFlags.Alias ? resolveAlias(symbol) : symbol);
16952-
case SyntaxKind.ThisKeyword:
16953-
return checkThisExpression(node);
16954-
case SyntaxKind.PropertyAccessExpression:
16955-
const type = getTypeOfDottedName((<PropertyAccessExpression>node).expression);
16956-
const prop = type && getPropertyOfType(type, (<PropertyAccessExpression>node).name.escapedText);
16957-
return prop && getExplicitTypeOfSymbol(prop);
16958-
case SyntaxKind.ParenthesizedExpression:
16959-
return getTypeOfDottedName((<ParenthesizedExpression>node).expression);
16948+
if (!(node.flags & NodeFlags.InWithStatement)) {
16949+
switch (node.kind) {
16950+
case SyntaxKind.Identifier:
16951+
const symbol = getResolvedSymbol(<Identifier>node);
16952+
return getExplicitTypeOfSymbol(symbol.flags & SymbolFlags.Alias ? resolveAlias(symbol) : symbol);
16953+
case SyntaxKind.ThisKeyword:
16954+
return checkThisExpression(node);
16955+
case SyntaxKind.PropertyAccessExpression:
16956+
const type = getTypeOfDottedName((<PropertyAccessExpression>node).expression);
16957+
const prop = type && getPropertyOfType(type, (<PropertyAccessExpression>node).name.escapedText);
16958+
return prop && getExplicitTypeOfSymbol(prop);
16959+
case SyntaxKind.ParenthesizedExpression:
16960+
return getTypeOfDottedName((<ParenthesizedExpression>node).expression);
16961+
}
1696016962
}
1696116963
}
1696216964

0 commit comments

Comments
 (0)