findAllRefs: Fix bug when symbol.declarations is undefined (#27977)

This commit is contained in:
Andy
2018-10-18 14:27:21 -07:00
committed by GitHub
parent 91bb32ade4
commit a3c22683ab
2 changed files with 11 additions and 1 deletions

View File

@@ -143,7 +143,7 @@ namespace ts.FindAllReferences {
function getDefinitionKindAndDisplayParts(symbol: Symbol, checker: TypeChecker, node: Node): { displayParts: SymbolDisplayPart[], kind: ScriptElementKind } {
const meaning = Core.getIntersectingMeaningFromDeclarations(node, symbol);
const enclosingDeclaration = firstOrUndefined(symbol.declarations) || node;
const enclosingDeclaration = symbol.declarations && firstOrUndefined(symbol.declarations) || node;
const { displayParts, symbolKind } =
SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, enclosingDeclaration.getSourceFile(), enclosingDeclaration, enclosingDeclaration, meaning);
return { displayParts, kind: symbolKind };

View File

@@ -0,0 +1,10 @@
/// <reference path="fourslash.ts" />
// @strict: true
////function f(x: { [K in "m"]: number; }) {
//// x.[|m|];
//// x.[|m|]
////}
verify.singleReferenceGroup("(property) m: number");