From 865b805e2154fc28998f766fde856e3cb9fba69c Mon Sep 17 00:00:00 2001 From: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Date: Tue, 23 Aug 2022 16:00:14 -0500 Subject: [PATCH 1/5] types(GuildChannelManager): correct fetch return type (v13) --- src/managers/GuildChannelManager.js | 2 +- typings/index.d.ts | 2 +- typings/index.test-d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/managers/GuildChannelManager.js b/src/managers/GuildChannelManager.js index 0558187c54c6..46a7bd6555eb 100644 --- a/src/managers/GuildChannelManager.js +++ b/src/managers/GuildChannelManager.js @@ -324,7 +324,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/typings/index.d.ts b/typings/index.d.ts index f037d607f3de..dfdc2dea531e 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -3232,7 +3232,7 @@ export class GuildChannelManager extends CachedManager; public edit(channel: GuildChannelResolvable, data: ChannelData, reason?: string): 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( diff --git a/typings/index.test-d.ts b/typings/index.test-d.ts index 425d09e75f63..82292f6dfa06 100644 --- a/typings/index.test-d.ts +++ b/typings/index.test-d.ts @@ -910,7 +910,7 @@ declare const guildChannelManager: GuildChannelManager; expectType>>(guildChannelManager.fetch()); expectType>>(guildChannelManager.fetch(undefined, {})); - expectType>(guildChannelManager.fetch('0')); + expectType>(guildChannelManager.fetch('0')); } declare const roleManager: RoleManager; From 66f2f57974dae1f172ed88ed77dae648a3ef13c5 Mon Sep 17 00:00:00 2001 From: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Date: Tue, 23 Aug 2022 16:59:59 -0500 Subject: [PATCH 2/5] Update packages/discord.js/src/managers/GuildChannelManager.js --- src/managers/GuildChannelManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/managers/GuildChannelManager.js b/src/managers/GuildChannelManager.js index 46a7bd6555eb..fd8edc06617a 100644 --- a/src/managers/GuildChannelManager.js +++ b/src/managers/GuildChannelManager.js @@ -324,7 +324,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 95e00336b36fddbb31327f8efbceb741938aebcb Mon Sep 17 00:00:00 2001 From: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Date: Mon, 5 Sep 2022 12:06:19 -0500 Subject: [PATCH 3/5] types: allow channels in the collection to be null Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> --- src/managers/GuildChannelManager.js | 2 +- typings/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/managers/GuildChannelManager.js b/src/managers/GuildChannelManager.js index fd8edc06617a..f45df226c31f 100644 --- a/src/managers/GuildChannelManager.js +++ b/src/managers/GuildChannelManager.js @@ -324,7 +324,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/typings/index.d.ts b/typings/index.d.ts index dfdc2dea531e..242a7f835ce5 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -3233,7 +3233,7 @@ export class GuildChannelManager extends CachedManager; public edit(channel: GuildChannelResolvable, data: ChannelData, reason?: string): 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 c0535ba994c933ae4656c9edf98d2ca80b0aab75 Mon Sep 17 00:00:00 2001 From: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Date: Mon, 5 Sep 2022 12:07:54 -0500 Subject: [PATCH 4/5] style: run prettier Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> --- typings/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index 242a7f835ce5..53b2f19483d5 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -3233,7 +3233,10 @@ export class GuildChannelManager extends CachedManager; public edit(channel: GuildChannelResolvable, data: ChannelData, reason?: string): 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 81bf261e2479cb063b64b1ebdfa5893af9286414 Mon Sep 17 00:00:00 2001 From: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Date: Mon, 5 Sep 2022 12:12:01 -0500 Subject: [PATCH 5/5] test: fix types again Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> --- typings/index.test-d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typings/index.test-d.ts b/typings/index.test-d.ts index 82292f6dfa06..1108c3bb3b6c 100644 --- a/typings/index.test-d.ts +++ b/typings/index.test-d.ts @@ -908,8 +908,8 @@ declare const guildChannelManager: GuildChannelManager; expectType>(guildChannelManager.create('name', { type: 'GUILD_STORE' })); expectType>(guildChannelManager.create('name', { type: 'GUILD_STAGE_VOICE' })); - expectType>>(guildChannelManager.fetch()); - expectType>>(guildChannelManager.fetch(undefined, {})); + expectType>>(guildChannelManager.fetch()); + expectType>>(guildChannelManager.fetch(undefined, {})); expectType>(guildChannelManager.fetch('0')); }