fix: Correct @link tags that involve parents (#9351)

This commit is contained in:
Jiralite
2023-04-09 10:22:07 +01:00
committed by GitHub
parent b2eec5f9fc
commit fbbce3eb4b
3 changed files with 8 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ import type {
ApiPropertySignature,
} from '@microsoft/api-extractor-model';
import type { TableOfContentsSerialized } from '../TableOfContentItems';
import { METHOD_SEPARATOR, OVERLOAD_SEPARATOR } from '~/util/constants';
import { resolveMembers } from '~/util/members';
export function hasProperties(item: ApiItemContainerMixin) {
@@ -23,7 +24,9 @@ export function hasMethods(item: ApiItemContainerMixin) {
}
export function resolveItemURI(item: ApiItem): string {
return `${item.displayName}:${item.kind}`;
return !item.parent || item.parent.kind === ApiItemKind.EntryPoint
? `${item.displayName}${OVERLOAD_SEPARATOR}${item.kind}`
: `${item.parent.displayName}${OVERLOAD_SEPARATOR}${item.parent.kind}${METHOD_SEPARATOR}${item.displayName}`;
}
function memberPredicate(item: ApiItem): item is ApiMethod | ApiMethodSignature | ApiProperty | ApiPropertySignature {

View File

@@ -16,6 +16,8 @@ export const N_RECENT_VERSIONS = 2;
export const OVERLOAD_SEPARATOR = ':';
export const METHOD_SEPARATOR = '#';
export const DESCRIPTION =
"discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.";