Skip to content

Commit a3c2268

Browse files
author
Andy
authored
findAllRefs: Fix bug when symbol.declarations is undefined (#27977)
1 parent 91bb32a commit a3c2268

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/services/findAllReferences.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ namespace ts.FindAllReferences {
143143

144144
function getDefinitionKindAndDisplayParts(symbol: Symbol, checker: TypeChecker, node: Node): { displayParts: SymbolDisplayPart[], kind: ScriptElementKind } {
145145
const meaning = Core.getIntersectingMeaningFromDeclarations(node, symbol);
146-
const enclosingDeclaration = firstOrUndefined(symbol.declarations) || node;
146+
const enclosingDeclaration = symbol.declarations && firstOrUndefined(symbol.declarations) || node;
147147
const { displayParts, symbolKind } =
148148
SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, enclosingDeclaration.getSourceFile(), enclosingDeclaration, enclosingDeclaration, meaning);
149149
return { displayParts, kind: symbolKind };
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @strict: true
4+
5+
////function f(x: { [K in "m"]: number; }) {
6+
//// x.[|m|];
7+
//// x.[|m|]
8+
////}
9+
10+
verify.singleReferenceGroup("(property) m: number");

0 commit comments

Comments
 (0)