fix(docs): some link tags didn't resolve correctly (#10269)

* fix(docs): some link tags didn't resolve in summaries

* fix: add TextBasedChannels type
This commit is contained in:
Qjuh
2024-05-13 11:34:11 +02:00
committed by GitHub
parent 393ded4ea1
commit 914cc4ba54
14 changed files with 41 additions and 37 deletions

View File

@@ -30,7 +30,7 @@ export async function DocNode({ node, version }: { readonly node?: any; readonly
rel="external noreferrer noopener" rel="external noreferrer noopener"
target="_blank" target="_blank"
> >
{node.text} {`${node.text}${node.members}`}
</a> </a>
); );
} }

View File

@@ -6,6 +6,7 @@ import { type ApiItem, ApiItemKind } from '../items/ApiItem.js';
import { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin.js'; import { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin.js';
import { ApiParameterListMixin } from '../mixins/ApiParameterListMixin.js'; import { ApiParameterListMixin } from '../mixins/ApiParameterListMixin.js';
import type { ApiEntryPoint } from './ApiEntryPoint.js'; import type { ApiEntryPoint } from './ApiEntryPoint.js';
import type { ApiMethod } from './ApiMethod.js';
import type { ApiModel } from './ApiModel.js'; import type { ApiModel } from './ApiModel.js';
import type { ApiPackage } from './ApiPackage.js'; import type { ApiPackage } from './ApiPackage.js';
@@ -119,6 +120,10 @@ export class ModelReferenceResolver {
foundMembers.filter((member) => member.kind === ApiItemKind.Interface).length === foundMembers.length - 1 foundMembers.filter((member) => member.kind === ApiItemKind.Interface).length === foundMembers.length - 1
) { ) {
currentItem = foundClass; currentItem = foundClass;
} else if (
foundMembers.every((member) => member.kind === ApiItemKind.Method && (member as ApiMethod).overloadIndex)
) {
currentItem = foundMembers.find((member) => (member as ApiMethod).overloadIndex === 1)!;
} else { } else {
result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`; result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;
return result; return result;

View File

@@ -97,7 +97,7 @@ class GuildManager extends CachedManager {
*/ */
/** /**
* Resolves a GuildResolvable to a Guild object. * Resolves a {@link GuildResolvable} to a {@link Guild} object.
* @method resolve * @method resolve
* @memberof GuildManager * @memberof GuildManager
* @instance * @instance

View File

@@ -17,7 +17,7 @@ class GuildTextThreadManager extends ThreadManager {
/** /**
* Options for creating a thread. <warn>Only one of `startMessage` or `type` can be defined.</warn> * Options for creating a thread. <warn>Only one of `startMessage` or `type` can be defined.</warn>
* @typedef {StartThreadOptions} ThreadCreateOptions * @typedef {StartThreadOptions} GuildTextThreadCreateOptions
* @property {MessageResolvable} [startMessage] The message to start a thread from. * @property {MessageResolvable} [startMessage] The message to start a thread from.
* <warn>If this is defined, then the `type` of thread gets inferred automatically and cannot be changed.</warn> * <warn>If this is defined, then the `type` of thread gets inferred automatically and cannot be changed.</warn>
* @property {ThreadChannelTypes} [type] The type of thread to create. * @property {ThreadChannelTypes} [type] The type of thread to create.
@@ -30,7 +30,7 @@ class GuildTextThreadManager extends ThreadManager {
/** /**
* Creates a new thread in the channel. * Creates a new thread in the channel.
* @param {ThreadCreateOptions} [options] Options to create a new thread * @param {GuildTextThreadCreateOptions} [options] Options to create a new thread
* @returns {Promise<ThreadChannel>} * @returns {Promise<ThreadChannel>}
* @example * @example
* // Create a new public thread * // Create a new public thread

View File

@@ -63,20 +63,6 @@ class ThreadManager extends CachedManager {
* @returns {?Snowflake} * @returns {?Snowflake}
*/ */
/**
* Options for creating a thread. <warn>Only one of `startMessage` or `type` can be defined.</warn>
* @typedef {StartThreadOptions} ThreadCreateOptions
* @property {MessageResolvable} [startMessage] The message to start a thread from. <warn>If this is defined then type
* of thread gets automatically defined and cannot be changed. The provided `type` field will be ignored</warn>
* @property {ChannelType.AnnouncementThread|ChannelType.PublicThread|ChannelType.PrivateThread} [type]
* The type of thread to create.
* Defaults to {@link ChannelType.PublicThread} if created in a {@link TextChannel}
* <warn>When creating threads in a {@link NewsChannel} this is ignored and is always
* {@link ChannelType.AnnouncementThread}</warn>
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread
* <info>Can only be set when type will be {@link ChannelType.PrivateThread}</info>
*/
/** /**
* Options for fetching multiple threads. * Options for fetching multiple threads.
* @typedef {Object} FetchThreadsOptions * @typedef {Object} FetchThreadsOptions

View File

@@ -23,7 +23,7 @@ class ShardingManager extends EventEmitter {
/** /**
* The mode to spawn shards with for a {@link ShardingManager}. Can be either one of: * The mode to spawn shards with for a {@link ShardingManager}. Can be either one of:
* * 'process' to use child processes * * 'process' to use child processes
* * 'worker' to use [Worker threads](https://nodejs.org/api/worker_threads.html) * * 'worker' to use {@link Worker} threads
* @typedef {string} ShardingManagerMode * @typedef {string} ShardingManagerMode
*/ */

View File

@@ -164,7 +164,7 @@ class Guild extends AnonymousGuild {
if ('large' in data) { if ('large' in data) {
/** /**
* Whether the guild is "large" (has more than {@link WebsocketOptions large_threshold} members, 50 by default) * Whether the guild is "large" (has more than {@link WebSocketOptions large_threshold} members, 50 by default)
* @type {boolean} * @type {boolean}
*/ */
this.large = Boolean(data.large); this.large = Boolean(data.large);
@@ -291,7 +291,8 @@ class Guild extends AnonymousGuild {
if ('max_presences' in data) { if ('max_presences' in data) {
/** /**
* The maximum amount of presences the guild can have (this is `null` for all but the largest of guilds) * The maximum amount of presences the guild can have (this is `null` for all but the largest of guilds)
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info> * <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
* this parameter</info>
* @type {?number} * @type {?number}
*/ */
this.maximumPresences = data.max_presences; this.maximumPresences = data.max_presences;
@@ -322,7 +323,8 @@ class Guild extends AnonymousGuild {
if ('approximate_member_count' in data) { if ('approximate_member_count' in data) {
/** /**
* The approximate amount of members the guild has * The approximate amount of members the guild has
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info> * <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
* this parameter</info>
* @type {?number} * @type {?number}
*/ */
this.approximateMemberCount = data.approximate_member_count; this.approximateMemberCount = data.approximate_member_count;
@@ -333,7 +335,8 @@ class Guild extends AnonymousGuild {
if ('approximate_presence_count' in data) { if ('approximate_presence_count' in data) {
/** /**
* The approximate amount of presences the guild has * The approximate amount of presences the guild has
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info> * <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
* this parameter</info>
* @type {?number} * @type {?number}
*/ */
this.approximatePresenceCount = data.approximate_presence_count; this.approximatePresenceCount = data.approximate_presence_count;

View File

@@ -229,7 +229,7 @@ class GuildScheduledEvent extends Base {
/** /**
* The time the guild scheduled event will start at * The time the guild scheduled event will start at
* <info>This can be potentially `null` only when it's an {@link AuditLogEntryTarget}</info> * <info>This can be potentially `null` only when it's an {@link GuildAuditLogsEntry#target}</info>
* @type {?Date} * @type {?Date}
* @readonly * @readonly
*/ */

View File

@@ -148,7 +148,7 @@ class PermissionOverwrites extends Base {
*/ */
/** /**
* Data that can be resolved into {@link RawOverwriteData}. This can be: * Data that can be resolved into {@link APIOverwrite}. This can be:
* * PermissionOverwrites * * PermissionOverwrites
* * OverwriteData * * OverwriteData
* @typedef {PermissionOverwrites|OverwriteData} OverwriteResolvable * @typedef {PermissionOverwrites|OverwriteData} OverwriteResolvable
@@ -164,7 +164,7 @@ class PermissionOverwrites extends Base {
*/ */
/** /**
* Resolves an overwrite into {@link RawOverwriteData}. * Resolves an overwrite into {@link APIOverwrite}.
* @param {OverwriteResolvable} overwrite The overwrite-like data to resolve * @param {OverwriteResolvable} overwrite The overwrite-like data to resolve
* @param {Guild} [guild] The guild to resolve from * @param {Guild} [guild] The guild to resolve from
* @returns {RawOverwriteData} * @returns {RawOverwriteData}

View File

@@ -81,7 +81,7 @@ class ReactionCollector extends Collector {
this.on('collect', (reaction, user) => { this.on('collect', (reaction, user) => {
/** /**
* Emitted whenever a reaction is newly created on a message. Will emit only when a new reaction is * Emitted whenever a reaction is newly created on a message. Will emit only when a new reaction is
* added to the message, as opposed to {@link Collector#collect} which will * added to the message, as opposed to {@link Collector#event:collect} which will
* be emitted even when a reaction has already been added to the message. * be emitted even when a reaction has already been added to the message.
* @event ReactionCollector#create * @event ReactionCollector#create
* @param {MessageReaction} reaction The reaction that was added * @param {MessageReaction} reaction The reaction that was added

View File

@@ -315,7 +315,7 @@ class ThreadChannel extends BaseChannel {
* Fetches the message that started this thread, if any. * Fetches the message that started this thread, if any.
* <info>The `Promise` will reject if the original message in a forum post is deleted * <info>The `Promise` will reject if the original message in a forum post is deleted
* or when the original message in the parent channel is deleted. * or when the original message in the parent channel is deleted.
* If you just need the id of that message, use {@link ThreadChannel#id} instead.</info> * If you just need the id of that message, use {@link BaseChannel#id} instead.</info>
* @param {BaseFetchOptions} [options] Additional options for this fetch * @param {BaseFetchOptions} [options] Additional options for this fetch
* @returns {Promise<?Message<true>>} * @returns {Promise<?Message<true>>}
*/ */

View File

@@ -160,6 +160,11 @@
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIModalSubmission} * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIModalSubmission}
*/ */
/**
* @external APIOverwrite
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIOverwrite}
*/
/** /**
* @external APIPartialEmoji * @external APIPartialEmoji
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIPartialEmoji} * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIPartialEmoji}

View File

@@ -95,15 +95,15 @@ exports.GuildTextBasedChannelTypes = [
/** /**
* The channels that are text-based. * The channels that are text-based.
* * DMChannel * * {@link DMChannel}
* * GuildTextBasedChannel * * {@link GuildTextBasedChannel}
* @typedef {DMChannel|GuildTextBasedChannel} TextBasedChannels * @typedef {DMChannel|GuildTextBasedChannel} TextBasedChannels
*/ */
/** /**
* Data that resolves to give a text-based channel. This can be: * Data that resolves to give a text-based channel. This can be:
* * A text-based channel * * A {@link TextBasedChannel}
* * A snowflake * * A {@link Snowflake}
* @typedef {TextBasedChannels|Snowflake} TextBasedChannelsResolvable * @typedef {TextBasedChannels|Snowflake} TextBasedChannelsResolvable
*/ */

View File

@@ -5160,6 +5160,13 @@ export interface WebhookCreateOptions extends ChannelWebhookCreateOptions {
channel: TextChannel | NewsChannel | VoiceChannel | StageChannel | ForumChannel | MediaChannel | Snowflake; channel: TextChannel | NewsChannel | VoiceChannel | StageChannel | ForumChannel | MediaChannel | Snowflake;
} }
export interface GuildMembersChunk {
index: number;
count: number;
notFound: readonly unknown[];
nonce: string | undefined;
}
export interface ClientEvents { export interface ClientEvents {
applicationCommandPermissionsUpdate: [data: ApplicationCommandPermissionsUpdateData]; applicationCommandPermissionsUpdate: [data: ApplicationCommandPermissionsUpdateData];
autoModerationActionExecution: [autoModerationActionExecution: AutoModerationActionExecution]; autoModerationActionExecution: [autoModerationActionExecution: AutoModerationActionExecution];
@@ -5197,11 +5204,7 @@ export interface ClientEvents {
guildMemberAdd: [member: GuildMember]; guildMemberAdd: [member: GuildMember];
guildMemberAvailable: [member: GuildMember | PartialGuildMember]; guildMemberAvailable: [member: GuildMember | PartialGuildMember];
guildMemberRemove: [member: GuildMember | PartialGuildMember]; guildMemberRemove: [member: GuildMember | PartialGuildMember];
guildMembersChunk: [ guildMembersChunk: [members: ReadonlyCollection<Snowflake, GuildMember>, guild: Guild, data: GuildMembersChunk];
members: ReadonlyCollection<Snowflake, GuildMember>,
guild: Guild,
data: { index: number; count: number; notFound: readonly unknown[]; nonce: string | undefined },
];
guildMemberUpdate: [oldMember: GuildMember | PartialGuildMember, newMember: GuildMember]; guildMemberUpdate: [oldMember: GuildMember | PartialGuildMember, newMember: GuildMember];
guildUpdate: [oldGuild: Guild, newGuild: Guild]; guildUpdate: [oldGuild: Guild, newGuild: Guild];
inviteCreate: [invite: Invite]; inviteCreate: [invite: Invite];
@@ -6723,6 +6726,8 @@ export type TextBasedChannel = Exclude<
PartialGroupDMChannel | ForumChannel | MediaChannel PartialGroupDMChannel | ForumChannel | MediaChannel
>; >;
export type TextBasedChannels = TextBasedChannel;
export type TextBasedChannelTypes = TextBasedChannel['type']; export type TextBasedChannelTypes = TextBasedChannel['type'];
export type GuildTextBasedChannelTypes = Exclude<TextBasedChannelTypes, ChannelType.DM>; export type GuildTextBasedChannelTypes = Exclude<TextBasedChannelTypes, ChannelType.DM>;