Skip to content

Commit

Permalink
types(GuildChannelManager): correct fetch return type (v13) (#8551)
Browse files Browse the repository at this point in the history
  • Loading branch information
RedGuy12 committed Sep 13, 2022
1 parent e6ee7d8 commit f4e8133
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/managers/GuildChannelManager.js
Expand Up @@ -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()
Expand Down
7 changes: 5 additions & 2 deletions typings/index.d.ts
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions typings/index.test-d.ts
Expand Up @@ -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;
Expand Down

0 comments on commit f4e8133

Please sign in to comment.