diff --git a/packages/scripts/src/generateSplitDocumentation.ts b/packages/scripts/src/generateSplitDocumentation.ts index 118e5a913..339b0ab81 100644 --- a/packages/scripts/src/generateSplitDocumentation.ts +++ b/packages/scripts/src/generateSplitDocumentation.ts @@ -258,26 +258,35 @@ function itemExcerptText(excerpt: Excerpt, apiPackage: ApiPackage) { }; } - const resolved = token.canonicalReference - ? resolveCanonicalReference(token.canonicalReference, apiPackage) - : null; + if (token.canonicalReference) { + const resolved = resolveCanonicalReference(token.canonicalReference, apiPackage); + + if (!resolved) { + return { + text: token.text, + }; + } + + const declarationReference = apiPackage + .getAssociatedModel() + ?.resolveDeclarationReference(token.canonicalReference, apiPackage); + const foundItem = declarationReference?.resolvedApiItem ?? resolved.item; - if (!resolved) { return { text: token.text, + resolvedItem: { + kind: foundItem.kind, + displayName: foundItem.displayName, + containerKey: foundItem.containerKey, + uri: resolveItemURI(foundItem), + packageName: resolved.package?.replace('@discordjs/', ''), + version: resolved.version, + }, }; } return { text: token.text, - resolvedItem: { - kind: resolved.item.kind, - displayName: resolved.item.displayName, - containerKey: resolved.item.containerKey, - uri: resolveItemURI(resolved.item), - packageName: resolved.package?.replace('@discordjs/', ''), - version: resolved.version, - }, }; }