From a0a5b0e4fad66833854a5e73b587022490eb52b6 Mon Sep 17 00:00:00 2001 From: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com> Date: Wed, 22 Dec 2021 08:00:07 -0500 Subject: [PATCH] types(CategoryChannel): `createChannel` should default to a text channel (#7132) --- typings/index.d.ts | 14 ++++++++------ typings/index.test-d.ts | 5 ++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index 577e4127c0b5..824b6b422d1c 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -494,19 +494,21 @@ export type CategoryChannelTypes = ExcludeEnum< export class CategoryChannel extends GuildChannel { public readonly children: Collection>; public type: 'GUILD_CATEGORY'; + + public createChannel>( + name: string, + options: CategoryCreateChannelOptions & { type: T }, + ): Promise; + /** @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' }, + options: CategoryCreateChannelOptions & { type: 'GUILD_STORE' | ChannelTypes.GUILD_STORE }, ): Promise; - public createChannel( - name: string, - options: CategoryCreateChannelOptions & { type: T }, - ): Promise; public createChannel( name: string, - options: CategoryCreateChannelOptions, + options?: CategoryCreateChannelOptions, ): Promise>; } diff --git a/typings/index.test-d.ts b/typings/index.test-d.ts index 971b12c5d92b..e60be82258a8 100644 --- a/typings/index.test-d.ts +++ b/typings/index.test-d.ts @@ -859,9 +859,8 @@ declare const categoryChannel: CategoryChannel; expectType>(categoryChannel.createChannel('name', { type: 'GUILD_NEWS' })); expectDeprecated(categoryChannel.createChannel('name', { type: 'GUILD_STORE' })); expectType>(categoryChannel.createChannel('name', { type: 'GUILD_STAGE_VOICE' })); - expectType>( - categoryChannel.createChannel('name', {}), - ); + expectType>>(categoryChannel.createChannel('name', {})); + expectType>>(categoryChannel.createChannel('name')); } declare const guildChannelManager: GuildChannelManager;