From a2e45837f7971fef351acf943afebab77b48b3f6 Mon Sep 17 00:00:00 2001 From: Pete Gonzalez <4673363+octogonz@users.noreply.github.com> Date: Sun, 8 Sep 2019 13:14:40 -0700 Subject: [PATCH] Create a ExcerptTokenKind.Reference node /only/ if the canonicalReference exists --- apps/api-extractor/src/generators/ExcerptBuilder.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/api-extractor/src/generators/ExcerptBuilder.ts b/apps/api-extractor/src/generators/ExcerptBuilder.ts index ce71e902a8f..2ce3784cdcd 100644 --- a/apps/api-extractor/src/generators/ExcerptBuilder.ts +++ b/apps/api-extractor/src/generators/ExcerptBuilder.ts @@ -117,11 +117,16 @@ export class ExcerptBuilder { } if (span.prefix) { + let canonicalReference: DeclarationReference | undefined = undefined; + if (span.kind === ts.SyntaxKind.Identifier) { const name: ts.Identifier = span.node as ts.Identifier; - const canonicalReference: DeclarationReference | undefined = isDeclarationName(name) - ? undefined - : state.referenceGenerator.getDeclarationReferenceForIdentifier(name); + if (!isDeclarationName(name)) { + canonicalReference = state.referenceGenerator.getDeclarationReferenceForIdentifier(name); + } + } + + if (canonicalReference) { ExcerptBuilder._appendToken(excerptTokens, ExcerptTokenKind.Reference, span.prefix, state, canonicalReference); } else {