Skip to content

Commit 83c3197

Browse files
author
Jason Killian
committed
Fixes an issue where references in ES6 imports aren't found unless in an import specifier
1 parent 83dce71 commit 83c3197

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/services/services.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -5490,9 +5490,10 @@ namespace ts {
54905490
};
54915491
}
54925492

5493-
function isImportOrExportSpecifierImportSymbol(symbol: Symbol) {
5493+
function isES6StyleImportSymbol(symbol: Symbol) {
54945494
return (symbol.flags & SymbolFlags.Alias) && forEach(symbol.declarations, declaration => {
5495-
return declaration.kind === SyntaxKind.ImportSpecifier || declaration.kind === SyntaxKind.ExportSpecifier;
5495+
return declaration.kind === SyntaxKind.ImportSpecifier || declaration.kind === SyntaxKind.ExportSpecifier
5496+
|| declaration.kind === SyntaxKind.ImportClause || declaration.kind === SyntaxKind.NamespaceImport;
54965497
});
54975498
}
54985499

@@ -5936,8 +5937,8 @@ namespace ts {
59365937
// The search set contains at least the current symbol
59375938
let result = [symbol];
59385939

5939-
// If the symbol is an alias, add what it alaises to the list
5940-
if (isImportOrExportSpecifierImportSymbol(symbol)) {
5940+
// If the symbol is an alias, add what it aliases to the list
5941+
if (isES6StyleImportSymbol(symbol)) {
59415942
result.push(typeChecker.getAliasedSymbol(symbol));
59425943
}
59435944

@@ -6028,7 +6029,7 @@ namespace ts {
60286029

60296030
// If the reference symbol is an alias, check if what it is aliasing is one of the search
60306031
// symbols.
6031-
if (isImportOrExportSpecifierImportSymbol(referenceSymbol)) {
6032+
if (isES6StyleImportSymbol(referenceSymbol)) {
60326033
const aliasedSymbol = typeChecker.getAliasedSymbol(referenceSymbol);
60336034
if (searchSymbols.indexOf(aliasedSymbol) >= 0) {
60346035
return aliasedSymbol;

0 commit comments

Comments
 (0)