types(GuildChannelManager): correct fetch return type (v13) (#8551)

This commit is contained in:
RedGuy12
2022-09-13 02:10:47 -05:00
committed by GitHub
parent e6ee7d8374
commit f4e81330bf
3 changed files with 9 additions and 6 deletions

View File

@@ -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<?GuildChannel|Collection<Snowflake, GuildChannel>>}
* @returns {Promise<?GuildChannel|ThreadChannel|Collection<Snowflake, ?GuildChannel>>}
* @example
* // Fetch all channels from the guild (excluding threads)
* message.guild.channels.fetch()

7
typings/index.d.ts vendored
View File

@@ -3229,8 +3229,11 @@ export class GuildChannelManager extends CachedManager<Snowflake, GuildBasedChan
options?: TextChannel | NewsChannel | VoiceChannel | Snowflake,
): Promise<Webhook>;
public edit(channel: GuildChannelResolvable, data: ChannelData, reason?: string): Promise<GuildChannel>;
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<NonThreadGuildBasedChannel | null>;
public fetch(id?: undefined, options?: BaseFetchOptions): Promise<Collection<Snowflake, NonThreadGuildBasedChannel>>;
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<GuildBasedChannel | null>;
public fetch(
id?: undefined,
options?: BaseFetchOptions,
): Promise<Collection<Snowflake, NonThreadGuildBasedChannel | null>>;
public fetchWebhooks(channel: GuildChannelResolvable): Promise<Collection<Snowflake, Webhook>>;
public setPosition(
channel: GuildChannelResolvable,

View File

@@ -908,9 +908,9 @@ declare const guildChannelManager: GuildChannelManager;
expectType<Promise<StoreChannel>>(guildChannelManager.create('name', { type: 'GUILD_STORE' }));
expectType<Promise<StageChannel>>(guildChannelManager.create('name', { type: 'GUILD_STAGE_VOICE' }));
expectType<Promise<Collection<Snowflake, AnyChannel>>>(guildChannelManager.fetch());
expectType<Promise<Collection<Snowflake, AnyChannel>>>(guildChannelManager.fetch(undefined, {}));
expectType<Promise<AnyChannel | null>>(guildChannelManager.fetch('0'));
expectType<Promise<Collection<Snowflake, AnyChannel | null>>>(guildChannelManager.fetch());
expectType<Promise<Collection<Snowflake, AnyChannel | null>>>(guildChannelManager.fetch(undefined, {}));
expectType<Promise<GuildBasedChannel | null>>(guildChannelManager.fetch('0'));
}
declare const roleManager: RoleManager;