From 5bcb82abb0f9527a0902403612f470c44afb1a33 Mon Sep 17 00:00:00 2001 From: RedGuy12 Date: Fri, 12 Aug 2022 12:18:18 -0500 Subject: [PATCH 1/8] types(GuildChannelManager): correct `fetch` return type --- packages/discord.js/typings/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 07bc24a3d25b..9441b0702a77 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -3362,7 +3362,7 @@ export class GuildChannelManager extends CachedManager; public createWebhook(options: WebhookCreateOptions): Promise; public edit(channel: GuildChannelResolvable, data: GuildChannelEditOptions): Promise; - public fetch(id: Snowflake, options?: BaseFetchOptions): Promise; + public fetch(id: Snowflake, options?: BaseFetchOptions): Promise; public fetch(id?: undefined, options?: BaseFetchOptions): Promise>; public fetchWebhooks(channel: GuildChannelResolvable): Promise>; public setPosition( From 281811cd28c8b46bec6335abb5aa4203d0103f87 Mon Sep 17 00:00:00 2001 From: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Date: Tue, 23 Aug 2022 14:51:43 -0500 Subject: [PATCH 2/8] fix(ci): fix the types tests --- packages/discord.js/typings/index.test-d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index 7946a360e758..da08d52aa5c3 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -1168,7 +1168,7 @@ declare const guildChannelManager: GuildChannelManager; expectType>>(guildChannelManager.fetch()); expectType>>(guildChannelManager.fetch(undefined, {})); - expectType>(guildChannelManager.fetch('0')); + expectType>(guildChannelManager.fetch('0')); } declare const messageManager: MessageManager; From 0b5c1306a48be3ac2e267ae31a3ab52217dbe4ed Mon Sep 17 00:00:00 2001 From: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Date: Tue, 23 Aug 2022 15:13:12 -0500 Subject: [PATCH 3/8] fix: fix the docs --- packages/discord.js/src/managers/GuildChannelManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/discord.js/src/managers/GuildChannelManager.js b/packages/discord.js/src/managers/GuildChannelManager.js index aa43dc350011..1378b048b7f5 100644 --- a/packages/discord.js/src/managers/GuildChannelManager.js +++ b/packages/discord.js/src/managers/GuildChannelManager.js @@ -317,7 +317,7 @@ class GuildChannelManager extends CachedManager { * Obtains one or more guild channels from Discord, or the channel cache if they're already available. * @param {Snowflake} [id] The channel's id * @param {BaseFetchOptions} [options] Additional options for this fetch - * @returns {Promise>} + * @returns {Promise>} * @example * // Fetch all channels from the guild (excluding threads) * message.guild.channels.fetch() From 140f60eba2bc56fe5af77abe632c95e13a18d924 Mon Sep 17 00:00:00 2001 From: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Date: Tue, 23 Aug 2022 16:59:37 -0500 Subject: [PATCH 4/8] Update packages/discord.js/src/managers/GuildChannelManager.js Co-authored-by: Almeida --- packages/discord.js/src/managers/GuildChannelManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/discord.js/src/managers/GuildChannelManager.js b/packages/discord.js/src/managers/GuildChannelManager.js index beff7837dacf..17a7f20be225 100644 --- a/packages/discord.js/src/managers/GuildChannelManager.js +++ b/packages/discord.js/src/managers/GuildChannelManager.js @@ -317,7 +317,7 @@ class GuildChannelManager extends CachedManager { * Obtains one or more guild channels from Discord, or the channel cache if they're already available. * @param {Snowflake} [id] The channel's id * @param {BaseFetchOptions} [options] Additional options for this fetch - * @returns {Promise>} + * @returns {Promise)>} * @example * // Fetch all channels from the guild (excluding threads) * message.guild.channels.fetch() From 44ab439fbdca62720b00fee93413a9a9733e1bb9 Mon Sep 17 00:00:00 2001 From: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Date: Mon, 5 Sep 2022 12:00:35 -0500 Subject: [PATCH 5/8] types: allow channels in the collection to be null Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> --- packages/discord.js/src/managers/GuildChannelManager.js | 2 +- packages/discord.js/typings/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/discord.js/src/managers/GuildChannelManager.js b/packages/discord.js/src/managers/GuildChannelManager.js index 17a7f20be225..7e76d5bc89b5 100644 --- a/packages/discord.js/src/managers/GuildChannelManager.js +++ b/packages/discord.js/src/managers/GuildChannelManager.js @@ -317,7 +317,7 @@ class GuildChannelManager extends CachedManager { * Obtains one or more guild channels from Discord, or the channel cache if they're already available. * @param {Snowflake} [id] The channel's id * @param {BaseFetchOptions} [options] Additional options for this fetch - * @returns {Promise)>} + * @returns {Promise>} * @example * // Fetch all channels from the guild (excluding threads) * message.guild.channels.fetch() diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index e681e1c4bf91..5e43b9fe80eb 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -3377,7 +3377,7 @@ export class GuildChannelManager extends CachedManager; public edit(channel: GuildChannelResolvable, data: GuildChannelEditOptions): Promise; public fetch(id: Snowflake, options?: BaseFetchOptions): Promise; - public fetch(id?: undefined, options?: BaseFetchOptions): Promise>; + public fetch(id?: undefined, options?: BaseFetchOptions): Promise>; public fetchWebhooks(channel: GuildChannelResolvable): Promise>; public setPosition( channel: GuildChannelResolvable, From 7f0e9c8e37d83fdc25854d74e29cb5bd498d5582 Mon Sep 17 00:00:00 2001 From: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Date: Mon, 5 Sep 2022 12:09:17 -0500 Subject: [PATCH 6/8] style: run prettier Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> --- packages/discord.js/typings/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 5e43b9fe80eb..0d7e6a1cabfe 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -3377,7 +3377,10 @@ export class GuildChannelManager extends CachedManager; public edit(channel: GuildChannelResolvable, data: GuildChannelEditOptions): Promise; public fetch(id: Snowflake, options?: BaseFetchOptions): Promise; - public fetch(id?: undefined, options?: BaseFetchOptions): Promise>; + public fetch( + id?: undefined, + options?: BaseFetchOptions, + ): Promise>; public fetchWebhooks(channel: GuildChannelResolvable): Promise>; public setPosition( channel: GuildChannelResolvable, From 945157c1f2db27d3f2ecf50ad403719d45c1a9e7 Mon Sep 17 00:00:00 2001 From: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Date: Mon, 5 Sep 2022 12:18:03 -0500 Subject: [PATCH 7/8] test: fix types again Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> --- packages/discord.js/typings/index.test-d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index 58b739cff84b..909e6645a6f6 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -1187,10 +1187,10 @@ declare const guildChannelManager: GuildChannelManager; expectType>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildNews })); expectType>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildStageVoice })); - expectType>>(guildChannelManager.fetch()); - expectType>>(guildChannelManager.fetch(undefined, {})); + expectType>>(guildChannelManager.fetch()); + expectType>>(guildChannelManager.fetch(undefined, {})); expectType>(guildChannelManager.fetch('0')); - + const channel = guildChannelManager.cache.first()!; if (channel.isTextBased()) { From 2ceefc591f0a5b285a21afcf14b7d854e91616d8 Mon Sep 17 00:00:00 2001 From: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Date: Mon, 5 Sep 2022 12:23:07 -0500 Subject: [PATCH 8/8] style: run prettier Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> --- packages/discord.js/typings/index.test-d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index 909e6645a6f6..cfca57b021e9 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -1190,7 +1190,7 @@ declare const guildChannelManager: GuildChannelManager; expectType>>(guildChannelManager.fetch()); expectType>>(guildChannelManager.fetch(undefined, {})); expectType>(guildChannelManager.fetch('0')); - + const channel = guildChannelManager.cache.first()!; if (channel.isTextBased()) {