diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 111ea98417d..24d7d648272 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -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; } diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport.ts b/tests/cases/fourslash/findAllRefsForDefaultExport.ts index c518bb8f59e..98e74e281ad 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport.ts @@ -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");