Skip to content

Commit

Permalink
types(CategoryChannel): fix createChannel return type (#7138)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImRodry committed Dec 24, 2021
1 parent e6f41b5 commit 1626dde
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions typings/index.d.ts
Expand Up @@ -509,11 +509,7 @@ export class CategoryChannel extends GuildChannel {
name: string,
options: CategoryCreateChannelOptions & { type: 'GUILD_STORE' | ChannelTypes.GUILD_STORE },
): Promise<StoreChannel>;

public createChannel(
name: string,
options?: CategoryCreateChannelOptions,
): Promise<Exclude<NonThreadGuildBasedChannel, CategoryChannel>>;
public createChannel(name: string, options?: CategoryCreateChannelOptions): Promise<TextChannel>;
}

export type CategoryChannelResolvable = Snowflake | CategoryChannel;
Expand Down
6 changes: 3 additions & 3 deletions typings/index.test-d.ts
Expand Up @@ -857,10 +857,10 @@ declare const categoryChannel: CategoryChannel;
expectType<Promise<VoiceChannel>>(categoryChannel.createChannel('name', { type: 'GUILD_VOICE' }));
expectType<Promise<TextChannel>>(categoryChannel.createChannel('name', { type: 'GUILD_TEXT' }));
expectType<Promise<NewsChannel>>(categoryChannel.createChannel('name', { type: 'GUILD_NEWS' }));
expectDeprecated(categoryChannel.createChannel('name', { type: 'GUILD_STORE' }));
expectType<Promise<StoreChannel>>(categoryChannel.createChannel('name', { type: 'GUILD_STORE' }));
expectType<Promise<StageChannel>>(categoryChannel.createChannel('name', { type: 'GUILD_STAGE_VOICE' }));
expectType<Promise<Exclude<NonThreadGuildBasedChannel, CategoryChannel>>>(categoryChannel.createChannel('name', {}));
expectType<Promise<Exclude<NonThreadGuildBasedChannel, CategoryChannel>>>(categoryChannel.createChannel('name'));
expectType<Promise<TextChannel>>(categoryChannel.createChannel('name', {}));
expectType<Promise<TextChannel>>(categoryChannel.createChannel('name'));
}

declare const guildChannelManager: GuildChannelManager;
Expand Down

0 comments on commit 1626dde

Please sign in to comment.