mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
types(CategoryChannel): createChannel should default to a text channel (#7132)
This commit is contained in:
16
typings/index.d.ts
vendored
16
typings/index.d.ts
vendored
@@ -494,19 +494,21 @@ export type CategoryChannelTypes = ExcludeEnum<
|
||||
export class CategoryChannel extends GuildChannel {
|
||||
public readonly children: Collection<Snowflake, Exclude<NonThreadGuildBasedChannel, CategoryChannel>>;
|
||||
public type: 'GUILD_CATEGORY';
|
||||
/** @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information */
|
||||
public createChannel(
|
||||
name: string,
|
||||
options: CategoryCreateChannelOptions & { type: 'GUILD_STORE' },
|
||||
): Promise<StoreChannel>;
|
||||
public createChannel<T extends CategoryChannelTypes>(
|
||||
|
||||
public createChannel<T extends Exclude<CategoryChannelTypes, 'GUILD_STORE'>>(
|
||||
name: string,
|
||||
options: CategoryCreateChannelOptions & { type: T },
|
||||
): Promise<MappedChannelCategoryTypes[T]>;
|
||||
|
||||
/** @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information */
|
||||
public createChannel(
|
||||
name: string,
|
||||
options: CategoryCreateChannelOptions,
|
||||
options: CategoryCreateChannelOptions & { type: 'GUILD_STORE' | ChannelTypes.GUILD_STORE },
|
||||
): Promise<StoreChannel>;
|
||||
|
||||
public createChannel(
|
||||
name: string,
|
||||
options?: CategoryCreateChannelOptions,
|
||||
): Promise<Exclude<NonThreadGuildBasedChannel, CategoryChannel>>;
|
||||
}
|
||||
|
||||
|
||||
@@ -859,9 +859,8 @@ declare const categoryChannel: CategoryChannel;
|
||||
expectType<Promise<NewsChannel>>(categoryChannel.createChannel('name', { type: 'GUILD_NEWS' }));
|
||||
expectDeprecated(categoryChannel.createChannel('name', { type: 'GUILD_STORE' }));
|
||||
expectType<Promise<StageChannel>>(categoryChannel.createChannel('name', { type: 'GUILD_STAGE_VOICE' }));
|
||||
expectType<Promise<TextChannel | VoiceChannel | NewsChannel | StoreChannel | StageChannel>>(
|
||||
categoryChannel.createChannel('name', {}),
|
||||
);
|
||||
expectType<Promise<Exclude<NonThreadGuildBasedChannel, CategoryChannel>>>(categoryChannel.createChannel('name', {}));
|
||||
expectType<Promise<Exclude<NonThreadGuildBasedChannel, CategoryChannel>>>(categoryChannel.createChannel('name'));
|
||||
}
|
||||
|
||||
declare const guildChannelManager: GuildChannelManager;
|
||||
|
||||
Reference in New Issue
Block a user