Skip to content

Commit 0b54089

Browse files
authoredFeb 20, 2022
types: V13 channel create overloads fix (#7480)
1 parent 77b8e01 commit 0b54089

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed
 

‎typings/index.d.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,10 @@ export class CategoryChannel extends GuildChannel {
500500
public readonly children: Collection<Snowflake, Exclude<NonThreadGuildBasedChannel, CategoryChannel>>;
501501
public type: 'GUILD_CATEGORY';
502502

503-
public createChannel<T extends Exclude<CategoryChannelTypes, 'GUILD_STORE'>>(
503+
public createChannel<T extends Exclude<CategoryChannelTypes, 'GUILD_STORE' | ChannelTypes.GUILD_STORE>>(
504504
name: string,
505505
options: CategoryCreateChannelOptions & { type: T },
506506
): Promise<MappedChannelCategoryTypes[T]>;
507-
508507
/** @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information */
509508
public createChannel(
510509
name: string,
@@ -3009,13 +3008,19 @@ export class GuildChannelManager extends CachedManager<Snowflake, GuildBasedChan
30093008
private constructor(guild: Guild, iterable?: Iterable<RawGuildChannelData>);
30103009
public readonly channelCountWithoutThreads: number;
30113010
public guild: Guild;
3012-
/** @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information */
3013-
public create(name: string, options: GuildChannelCreateOptions & { type: 'GUILD_STORE' }): Promise<StoreChannel>;
3014-
public create<T extends GuildChannelTypes>(
3011+
3012+
public create<T extends Exclude<GuildChannelTypes, 'GUILD_STORE' | ChannelTypes.GUILD_STORE>>(
30153013
name: string,
30163014
options: GuildChannelCreateOptions & { type: T },
30173015
): Promise<MappedGuildChannelTypes[T]>;
3018-
public create(name: string, options: GuildChannelCreateOptions): Promise<NonThreadGuildBasedChannel>;
3016+
3017+
/** @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information */
3018+
public create(
3019+
name: string,
3020+
options: GuildChannelCreateOptions & { type: 'GUILD_STORE' | ChannelTypes.GUILD_STORE },
3021+
): Promise<StoreChannel>;
3022+
3023+
public create(name: string, options?: GuildChannelCreateOptions): Promise<TextChannel>;
30193024
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<NonThreadGuildBasedChannel | null>;
30203025
public fetch(id?: undefined, options?: BaseFetchOptions): Promise<Collection<Snowflake, NonThreadGuildBasedChannel>>;
30213026
public setPositions(channelPositions: readonly ChannelPosition[]): Promise<Guild>;

‎typings/index.test-d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,8 @@ declare const guildChannelManager: GuildChannelManager;
867867
{
868868
type AnyChannel = TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel;
869869

870+
expectType<Promise<TextChannel>>(guildChannelManager.create('name'));
871+
expectType<Promise<TextChannel>>(guildChannelManager.create('name', {}));
870872
expectType<Promise<VoiceChannel>>(guildChannelManager.create('name', { type: 'GUILD_VOICE' }));
871873
expectType<Promise<CategoryChannel>>(guildChannelManager.create('name', { type: 'GUILD_CATEGORY' }));
872874
expectType<Promise<TextChannel>>(guildChannelManager.create('name', { type: 'GUILD_TEXT' }));

0 commit comments

Comments
 (0)
Please sign in to comment.