Skip to content

Commit

Permalink
fix(website): links to enum members from excerpts (#10388)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qjuh authored Jul 13, 2024
1 parent be04acd commit efa16a6
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions packages/scripts/src/generateSplitDocumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
};
}

Expand Down

0 comments on commit efa16a6

Please sign in to comment.