types: use mapped enums instead of overloads (#7088)

This commit is contained in:
Suneet Tipirneni
2021-12-14 13:03:39 -05:00
committed by GitHub
parent 9cf44d1c0e
commit 49f9a18020
2 changed files with 68 additions and 36 deletions

View File

@@ -756,7 +756,6 @@ declare const threadChannel: ThreadChannel;
declare const newsChannel: NewsChannel;
declare const textChannel: TextChannel;
declare const storeChannel: StoreChannel;
declare const categoryChannel: CategoryChannel;
declare const voiceChannel: VoiceChannel;
declare const guild: Guild;
declare const user: User;
@@ -848,6 +847,18 @@ expectType<Promise<Collection<Snowflake, ApplicationCommand>>>(guildApplicationC
expectType<Promise<Collection<Snowflake, ApplicationCommand>>>(guildApplicationCommandManager.fetch(undefined, {}));
expectType<Promise<ApplicationCommand>>(guildApplicationCommandManager.fetch('0'));
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<StageChannel>>(categoryChannel.createChannel('name', { type: 'GUILD_STAGE_VOICE' }));
expectType<Promise<TextChannel | VoiceChannel | NewsChannel | StoreChannel | StageChannel>>(
categoryChannel.createChannel('name', {}),
);
}
declare const guildChannelManager: GuildChannelManager;
{
type AnyChannel = TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel;