Skip to content

Commit

Permalink
Merge pull request #14131 from Microsoft/release-2.2_default_import_name
Browse files Browse the repository at this point in the history
Handle undefined import name
  • Loading branch information
mhegazy committed Feb 17, 2017
2 parents 125a8fa + ee13f31 commit 6b5c448
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 6b5c448

Please sign in to comment.