Skip to content

Commit

Permalink
fix: Correct @link tags that involve parents (#9351)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiralite committed Apr 9, 2023
1 parent b2eec5f commit fbbce3e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion apps/website/src/components/documentation/util.ts
Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions apps/website/src/util/constants.ts
Expand Up @@ -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.";

Expand Down
Expand Up @@ -50,7 +50,7 @@ export class SlashCommandBuilder {
* Whether the command is enabled by default when the app is added to a guild
*
* @deprecated This property is deprecated and will be removed in the future.
* You should use {@link (SlashCommandBuilder:class).setDefaultMemberPermissions} or {@link (SlashCommandBuilder:class).setDMPermission} instead.
* You should use {@link SlashCommandBuilder.setDefaultMemberPermissions} or {@link SlashCommandBuilder.setDMPermission} instead.
*/
public readonly default_permission: boolean | undefined = undefined;

Expand Down Expand Up @@ -96,7 +96,7 @@ export class SlashCommandBuilder {
* If set to `false`, you will have to later `PUT` the permissions for this command.
* @param value - Whether or not to enable this command by default
* @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}
* @deprecated Use {@link (SlashCommandBuilder:class).setDefaultMemberPermissions} or {@link (SlashCommandBuilder:class).setDMPermission} instead.
* @deprecated Use {@link SlashCommandBuilder.setDefaultMemberPermissions} or {@link SlashCommandBuilder.setDMPermission} instead.
*/
public setDefaultPermission(value: boolean) {
// Assert the value matches the conditions
Expand Down

1 comment on commit fbbce3e

@vercel
Copy link

@vercel vercel bot commented on fbbce3e Apr 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.