diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index eb2998c6e40..0061479133c 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -772,9 +772,11 @@ namespace ts.FindAllReferences.Core { case SyntaxKind.Identifier: return (node as Identifier).text.length === searchSymbolName.length; - case SyntaxKind.StringLiteral: - return (isLiteralNameOfPropertyDeclarationOrIndexAccess(node as StringLiteral) || isNameOfExternalModuleImportOrDeclaration(node)) && - (node as StringLiteral).text.length === searchSymbolName.length; + case SyntaxKind.StringLiteral: { + const str = node as StringLiteral; + return (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node)) && + str.text.length === searchSymbolName.length; + } case SyntaxKind.NumericLiteral: return isLiteralNameOfPropertyDeclarationOrIndexAccess(node as NumericLiteral) && (node as NumericLiteral).text.length === searchSymbolName.length; @@ -1735,14 +1737,6 @@ namespace ts.FindAllReferences.Core { return tryGetClassExtendingExpressionWithTypeArguments(climbPastPropertyAccess(node).parent); } - function isNameOfExternalModuleImportOrDeclaration(node: Node): boolean { - if (node.kind === SyntaxKind.StringLiteral) { - return isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node); - } - - return false; - } - /** * If we are just looking for implementations and this is a property access expression, we need to get the * symbol of the local type of the symbol the property is being accessed on. This is because our search