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 | 16 +++++++++------- typings/index.test-d.ts | 5 ++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index 577e4127c..824b6b422 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'; - /** @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; - public createChannel( + + 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, + options: CategoryCreateChannelOptions & { type: 'GUILD_STORE' | ChannelTypes.GUILD_STORE }, + ): Promise; + + public createChannel( + name: string, + options?: CategoryCreateChannelOptions, ): Promise>; } diff --git a/typings/index.test-d.ts b/typings/index.test-d.ts index 971b12c5d..e60be8225 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;