Skip to content

Commit f4e8133

Browse files
authoredSep 13, 2022
types(GuildChannelManager): correct fetch return type (v13) (#8551)
1 parent e6ee7d8 commit f4e8133

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed
 

‎src/managers/GuildChannelManager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class GuildChannelManager extends CachedManager {
324324
* Obtains one or more guild channels from Discord, or the channel cache if they're already available.
325325
* @param {Snowflake} [id] The channel's id
326326
* @param {BaseFetchOptions} [options] Additional options for this fetch
327-
* @returns {Promise<?GuildChannel|Collection<Snowflake, GuildChannel>>}
327+
* @returns {Promise<?GuildChannel|ThreadChannel|Collection<Snowflake, ?GuildChannel>>}
328328
* @example
329329
* // Fetch all channels from the guild (excluding threads)
330330
* message.guild.channels.fetch()

‎typings/index.d.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -3229,8 +3229,11 @@ export class GuildChannelManager extends CachedManager<Snowflake, GuildBasedChan
32293229
options?: TextChannel | NewsChannel | VoiceChannel | Snowflake,
32303230
): Promise<Webhook>;
32313231
public edit(channel: GuildChannelResolvable, data: ChannelData, reason?: string): Promise<GuildChannel>;
3232-
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<NonThreadGuildBasedChannel | null>;
3233-
public fetch(id?: undefined, options?: BaseFetchOptions): Promise<Collection<Snowflake, NonThreadGuildBasedChannel>>;
3232+
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<GuildBasedChannel | null>;
3233+
public fetch(
3234+
id?: undefined,
3235+
options?: BaseFetchOptions,
3236+
): Promise<Collection<Snowflake, NonThreadGuildBasedChannel | null>>;
32343237
public fetchWebhooks(channel: GuildChannelResolvable): Promise<Collection<Snowflake, Webhook>>;
32353238
public setPosition(
32363239
channel: GuildChannelResolvable,

‎typings/index.test-d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -908,9 +908,9 @@ declare const guildChannelManager: GuildChannelManager;
908908
expectType<Promise<StoreChannel>>(guildChannelManager.create('name', { type: 'GUILD_STORE' }));
909909
expectType<Promise<StageChannel>>(guildChannelManager.create('name', { type: 'GUILD_STAGE_VOICE' }));
910910

911-
expectType<Promise<Collection<Snowflake, AnyChannel>>>(guildChannelManager.fetch());
912-
expectType<Promise<Collection<Snowflake, AnyChannel>>>(guildChannelManager.fetch(undefined, {}));
913-
expectType<Promise<AnyChannel | null>>(guildChannelManager.fetch('0'));
911+
expectType<Promise<Collection<Snowflake, AnyChannel | null>>>(guildChannelManager.fetch());
912+
expectType<Promise<Collection<Snowflake, AnyChannel | null>>>(guildChannelManager.fetch(undefined, {}));
913+
expectType<Promise<GuildBasedChannel | null>>(guildChannelManager.fetch('0'));
914914
}
915915

916916
declare const roleManager: RoleManager;

0 commit comments

Comments
 (0)
Please sign in to comment.