Skip to content

Commit 914cc4b

Browse files
authoredMay 13, 2024··
fix(docs): some link tags didn't resolve correctly (#10269)
* fix(docs): some link tags didn't resolve in summaries * fix: add TextBasedChannels type
1 parent 393ded4 commit 914cc4b

File tree

14 files changed

+41
-37
lines changed

14 files changed

+41
-37
lines changed
 

‎apps/website/src/components/DocNode.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function DocNode({ node, version }: { readonly node?: any; readonly
3030
rel="external noreferrer noopener"
3131
target="_blank"
3232
>
33-
{node.text}
33+
{`${node.text}${node.members}`}
3434
</a>
3535
);
3636
}

‎packages/api-extractor-model/src/model/ModelReferenceResolver.ts

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { type ApiItem, ApiItemKind } from '../items/ApiItem.js';
66
import { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin.js';
77
import { ApiParameterListMixin } from '../mixins/ApiParameterListMixin.js';
88
import type { ApiEntryPoint } from './ApiEntryPoint.js';
9+
import type { ApiMethod } from './ApiMethod.js';
910
import type { ApiModel } from './ApiModel.js';
1011
import type { ApiPackage } from './ApiPackage.js';
1112

@@ -119,6 +120,10 @@ export class ModelReferenceResolver {
119120
foundMembers.filter((member) => member.kind === ApiItemKind.Interface).length === foundMembers.length - 1
120121
) {
121122
currentItem = foundClass;
123+
} else if (
124+
foundMembers.every((member) => member.kind === ApiItemKind.Method && (member as ApiMethod).overloadIndex)
125+
) {
126+
currentItem = foundMembers.find((member) => (member as ApiMethod).overloadIndex === 1)!;
122127
} else {
123128
result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;
124129
return result;

‎packages/discord.js/src/managers/GuildManager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class GuildManager extends CachedManager {
9797
*/
9898

9999
/**
100-
* Resolves a GuildResolvable to a Guild object.
100+
* Resolves a {@link GuildResolvable} to a {@link Guild} object.
101101
* @method resolve
102102
* @memberof GuildManager
103103
* @instance

‎packages/discord.js/src/managers/GuildTextThreadManager.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class GuildTextThreadManager extends ThreadManager {
1717

1818
/**
1919
* Options for creating a thread. <warn>Only one of `startMessage` or `type` can be defined.</warn>
20-
* @typedef {StartThreadOptions} ThreadCreateOptions
20+
* @typedef {StartThreadOptions} GuildTextThreadCreateOptions
2121
* @property {MessageResolvable} [startMessage] The message to start a thread from.
2222
* <warn>If this is defined, then the `type` of thread gets inferred automatically and cannot be changed.</warn>
2323
* @property {ThreadChannelTypes} [type] The type of thread to create.
@@ -30,7 +30,7 @@ class GuildTextThreadManager extends ThreadManager {
3030

3131
/**
3232
* Creates a new thread in the channel.
33-
* @param {ThreadCreateOptions} [options] Options to create a new thread
33+
* @param {GuildTextThreadCreateOptions} [options] Options to create a new thread
3434
* @returns {Promise<ThreadChannel>}
3535
* @example
3636
* // Create a new public thread

‎packages/discord.js/src/managers/ThreadManager.js

-14
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,6 @@ class ThreadManager extends CachedManager {
6363
* @returns {?Snowflake}
6464
*/
6565

66-
/**
67-
* Options for creating a thread. <warn>Only one of `startMessage` or `type` can be defined.</warn>
68-
* @typedef {StartThreadOptions} ThreadCreateOptions
69-
* @property {MessageResolvable} [startMessage] The message to start a thread from. <warn>If this is defined then type
70-
* of thread gets automatically defined and cannot be changed. The provided `type` field will be ignored</warn>
71-
* @property {ChannelType.AnnouncementThread|ChannelType.PublicThread|ChannelType.PrivateThread} [type]
72-
* The type of thread to create.
73-
* Defaults to {@link ChannelType.PublicThread} if created in a {@link TextChannel}
74-
* <warn>When creating threads in a {@link NewsChannel} this is ignored and is always
75-
* {@link ChannelType.AnnouncementThread}</warn>
76-
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread
77-
* <info>Can only be set when type will be {@link ChannelType.PrivateThread}</info>
78-
*/
79-
8066
/**
8167
* Options for fetching multiple threads.
8268
* @typedef {Object} FetchThreadsOptions

‎packages/discord.js/src/sharding/ShardingManager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ShardingManager extends EventEmitter {
2323
/**
2424
* The mode to spawn shards with for a {@link ShardingManager}. Can be either one of:
2525
* * 'process' to use child processes
26-
* * 'worker' to use [Worker threads](https://nodejs.org/api/worker_threads.html)
26+
* * 'worker' to use {@link Worker} threads
2727
* @typedef {string} ShardingManagerMode
2828
*/
2929

‎packages/discord.js/src/structures/Guild.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class Guild extends AnonymousGuild {
164164

165165
if ('large' in data) {
166166
/**
167-
* Whether the guild is "large" (has more than {@link WebsocketOptions large_threshold} members, 50 by default)
167+
* Whether the guild is "large" (has more than {@link WebSocketOptions large_threshold} members, 50 by default)
168168
* @type {boolean}
169169
*/
170170
this.large = Boolean(data.large);
@@ -291,7 +291,8 @@ class Guild extends AnonymousGuild {
291291
if ('max_presences' in data) {
292292
/**
293293
* The maximum amount of presences the guild can have (this is `null` for all but the largest of guilds)
294-
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
294+
* <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
295+
* this parameter</info>
295296
* @type {?number}
296297
*/
297298
this.maximumPresences = data.max_presences;
@@ -322,7 +323,8 @@ class Guild extends AnonymousGuild {
322323
if ('approximate_member_count' in data) {
323324
/**
324325
* The approximate amount of members the guild has
325-
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
326+
* <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
327+
* this parameter</info>
326328
* @type {?number}
327329
*/
328330
this.approximateMemberCount = data.approximate_member_count;
@@ -333,7 +335,8 @@ class Guild extends AnonymousGuild {
333335
if ('approximate_presence_count' in data) {
334336
/**
335337
* The approximate amount of presences the guild has
336-
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
338+
* <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
339+
* this parameter</info>
337340
* @type {?number}
338341
*/
339342
this.approximatePresenceCount = data.approximate_presence_count;

‎packages/discord.js/src/structures/GuildScheduledEvent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class GuildScheduledEvent extends Base {
229229

230230
/**
231231
* The time the guild scheduled event will start at
232-
* <info>This can be potentially `null` only when it's an {@link AuditLogEntryTarget}</info>
232+
* <info>This can be potentially `null` only when it's an {@link GuildAuditLogsEntry#target}</info>
233233
* @type {?Date}
234234
* @readonly
235235
*/

‎packages/discord.js/src/structures/PermissionOverwrites.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class PermissionOverwrites extends Base {
148148
*/
149149

150150
/**
151-
* Data that can be resolved into {@link RawOverwriteData}. This can be:
151+
* Data that can be resolved into {@link APIOverwrite}. This can be:
152152
* * PermissionOverwrites
153153
* * OverwriteData
154154
* @typedef {PermissionOverwrites|OverwriteData} OverwriteResolvable
@@ -164,7 +164,7 @@ class PermissionOverwrites extends Base {
164164
*/
165165

166166
/**
167-
* Resolves an overwrite into {@link RawOverwriteData}.
167+
* Resolves an overwrite into {@link APIOverwrite}.
168168
* @param {OverwriteResolvable} overwrite The overwrite-like data to resolve
169169
* @param {Guild} [guild] The guild to resolve from
170170
* @returns {RawOverwriteData}

‎packages/discord.js/src/structures/ReactionCollector.js

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

‎packages/discord.js/src/structures/ThreadChannel.js

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

‎packages/discord.js/src/util/APITypes.js

+5
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@
160160
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIModalSubmission}
161161
*/
162162

163+
/**
164+
* @external APIOverwrite
165+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIOverwrite}
166+
*/
167+
163168
/**
164169
* @external APIPartialEmoji
165170
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIPartialEmoji}

‎packages/discord.js/src/util/Constants.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ exports.GuildTextBasedChannelTypes = [
9595

9696
/**
9797
* The channels that are text-based.
98-
* * DMChannel
99-
* * GuildTextBasedChannel
98+
* * {@link DMChannel}
99+
* * {@link GuildTextBasedChannel}
100100
* @typedef {DMChannel|GuildTextBasedChannel} TextBasedChannels
101101
*/
102102

103103
/**
104104
* Data that resolves to give a text-based channel. This can be:
105-
* * A text-based channel
106-
* * A snowflake
105+
* * A {@link TextBasedChannel}
106+
* * A {@link Snowflake}
107107
* @typedef {TextBasedChannels|Snowflake} TextBasedChannelsResolvable
108108
*/
109109

‎packages/discord.js/typings/index.d.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -5160,6 +5160,13 @@ export interface WebhookCreateOptions extends ChannelWebhookCreateOptions {
51605160
channel: TextChannel | NewsChannel | VoiceChannel | StageChannel | ForumChannel | MediaChannel | Snowflake;
51615161
}
51625162

5163+
export interface GuildMembersChunk {
5164+
index: number;
5165+
count: number;
5166+
notFound: readonly unknown[];
5167+
nonce: string | undefined;
5168+
}
5169+
51635170
export interface ClientEvents {
51645171
applicationCommandPermissionsUpdate: [data: ApplicationCommandPermissionsUpdateData];
51655172
autoModerationActionExecution: [autoModerationActionExecution: AutoModerationActionExecution];
@@ -5197,11 +5204,7 @@ export interface ClientEvents {
51975204
guildMemberAdd: [member: GuildMember];
51985205
guildMemberAvailable: [member: GuildMember | PartialGuildMember];
51995206
guildMemberRemove: [member: GuildMember | PartialGuildMember];
5200-
guildMembersChunk: [
5201-
members: ReadonlyCollection<Snowflake, GuildMember>,
5202-
guild: Guild,
5203-
data: { index: number; count: number; notFound: readonly unknown[]; nonce: string | undefined },
5204-
];
5207+
guildMembersChunk: [members: ReadonlyCollection<Snowflake, GuildMember>, guild: Guild, data: GuildMembersChunk];
52055208
guildMemberUpdate: [oldMember: GuildMember | PartialGuildMember, newMember: GuildMember];
52065209
guildUpdate: [oldGuild: Guild, newGuild: Guild];
52075210
inviteCreate: [invite: Invite];
@@ -6723,6 +6726,8 @@ export type TextBasedChannel = Exclude<
67236726
PartialGroupDMChannel | ForumChannel | MediaChannel
67246727
>;
67256728

6729+
export type TextBasedChannels = TextBasedChannel;
6730+
67266731
export type TextBasedChannelTypes = TextBasedChannel['type'];
67276732

67286733
export type GuildTextBasedChannelTypes = Exclude<TextBasedChannelTypes, ChannelType.DM>;

0 commit comments

Comments
 (0)
Please sign in to comment.