Skip to content

Commit

Permalink
Handle undefined import name
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Hanson committed Feb 16, 2017
1 parent 510b384 commit ee13f31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/findAllReferences.ts
Expand Up @@ -154,7 +154,7 @@ namespace ts.FindAllReferences {
const importDecl = importSpecifier.parent as ts.ImportDeclaration;
Debug.assert(importDecl.moduleSpecifier === importSpecifier);
const defaultName = importDecl.importClause.name;
const defaultReferencedSymbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName));
const defaultReferencedSymbol = defaultName && checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName));
if (symbol === defaultReferencedSymbol) {
return defaultName.text;
}
Expand Down
3 changes: 3 additions & 0 deletions tests/cases/fourslash/findAllRefsForDefaultExport.ts
Expand Up @@ -7,5 +7,8 @@
////import [|{| "isWriteAccess": true, "isDefinition": true |}g|] from "./a";
/////*ref*/[|g|]();

// @Filename: c.ts
////import { f } from "./a";

verify.singleReferenceGroup("function f(): void");
verify.goToDefinition("ref", "def");

0 comments on commit ee13f31

Please sign in to comment.