diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index d5403dcff6d4..a65f623af14a 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -24,6 +24,7 @@ import { APIEmbed, ApplicationCommandType, APIMessage, + APIStringSelectComponent, } from 'discord-api-types/v10'; import { ApplicationCommand, @@ -72,7 +73,6 @@ import { ReactionCollector, Role, RoleManager, - SelectMenuInteraction, Serialized, ShardClientUtil, ShardingManager, @@ -142,6 +142,8 @@ import { GuildForumThreadManager, GuildTextThreadManager, AnySelectMenuInteraction, + StringSelectMenuInteraction, + StringSelectMenuComponent, } from '.'; import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd'; import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders'; @@ -362,14 +364,14 @@ client.on('messageCreate', async message => { expectAssignable>(buttonCollector); // Verify that select menus interaction are inferred. - const selectMenuCollector = message.createMessageComponentCollector({ componentType: ComponentType.SelectMenu }); - expectAssignable>( - message.awaitMessageComponent({ componentType: ComponentType.SelectMenu }), + const selectMenuCollector = message.createMessageComponentCollector({ componentType: ComponentType.StringSelect }); + expectAssignable>( + message.awaitMessageComponent({ componentType: ComponentType.StringSelect }), ); - expectAssignable>( - channel.awaitMessageComponent({ componentType: ComponentType.SelectMenu }), + expectAssignable>( + channel.awaitMessageComponent({ componentType: ComponentType.StringSelect }), ); - expectAssignable>(selectMenuCollector); + expectAssignable>(selectMenuCollector); // Verify that message component interactions are default collected types. const defaultCollector = message.createMessageComponentCollector(); @@ -406,9 +408,9 @@ client.on('messageCreate', async message => { }); message.createMessageComponentCollector({ - componentType: ComponentType.SelectMenu, + componentType: ComponentType.StringSelect, filter: i => { - expectType(i); + expectType(i); return true; }, }); @@ -429,9 +431,9 @@ client.on('messageCreate', async message => { }); message.awaitMessageComponent({ - componentType: ComponentType.SelectMenu, + componentType: ComponentType.StringSelect, filter: i => { - expectType(i); + expectType(i); return true; }, }); @@ -465,9 +467,9 @@ client.on('messageCreate', async message => { }); channel.awaitMessageComponent({ - componentType: ComponentType.SelectMenu, + componentType: ComponentType.StringSelect, filter: i => { - expectType>(i); + expectType>(i); return true; }, }); @@ -492,7 +494,7 @@ client.on('messageCreate', async message => { components: [ new SelectMenuBuilder(), { - type: ComponentType.SelectMenu, + type: ComponentType.StringSelect, label: 'select menu', options: [{ label: 'test', value: 'test' }], customId: 'test', @@ -1123,7 +1125,7 @@ client.on('guildCreate', async g => { new ButtonBuilder(), { type: ComponentType.Button, style: ButtonStyle.Primary, label: 'string', customId: 'foo' }, { type: ComponentType.Button, style: ButtonStyle.Link, label: 'test', url: 'test' }, - { type: ComponentType.SelectMenu, customId: 'foo' }, + { type: ComponentType.StringSelect, customId: 'foo' }, new SelectMenuBuilder(), // @ts-expect-error { type: ComponentType.TextInput, style: TextInputStyle.Paragraph, customId: 'foo', label: 'test' }, @@ -1137,7 +1139,7 @@ client.on('guildCreate', async g => { components: [ { type: ComponentType.Button, style: ButtonStyle.Primary, label: 'string', customId: 'foo' }, { type: ComponentType.Button, style: ButtonStyle.Link, label: 'test', url: 'test' }, - { type: ComponentType.SelectMenu, customId: 'foo' }, + { type: ComponentType.StringSelect, customId: 'foo' }, ], }); @@ -1641,24 +1643,27 @@ client.on('interactionCreate', async interaction => { } } - if (interaction.type === InteractionType.MessageComponent && interaction.componentType === ComponentType.SelectMenu) { - expectType(interaction); - expectType(interaction.component); + if ( + interaction.type === InteractionType.MessageComponent && + interaction.componentType === ComponentType.StringSelect + ) { + expectType(interaction); + expectType(interaction.component); expectType(interaction.message); if (interaction.inCachedGuild()) { - expectAssignable(interaction); + expectAssignable(interaction); expectType(interaction.component); expectType>(interaction.message); expectType(interaction.guild); expectType>>(interaction.reply({ fetchReply: true })); } else if (interaction.inRawGuild()) { - expectAssignable(interaction); + expectAssignable(interaction); expectType(interaction.component); expectType>(interaction.message); expectType(interaction.guild); expectType>>(interaction.reply({ fetchReply: true })); } else if (interaction.inGuild()) { - expectAssignable(interaction); + expectAssignable(interaction); expectType(interaction.component); expectType(interaction.message); expectType(interaction.guild);