mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
refactor!: replace isAnySelectMenu with isSelectMenu (#10656)
BREAKING CHANGE: `BaseInteraction#isAnySelectMenu()` has been removed. Use `BaseInteraction#isSelectMenu()` instead. --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -262,7 +262,7 @@ class BaseInteraction extends Base {
|
||||
* Indicates whether this interaction is a select menu of any known type.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isAnySelectMenu() {
|
||||
isSelectMenu() {
|
||||
return this.type === InteractionType.MessageComponent && SelectMenuTypes.includes(this.componentType);
|
||||
}
|
||||
|
||||
|
||||
4
packages/discord.js/typings/index.d.ts
vendored
4
packages/discord.js/typings/index.d.ts
vendored
@@ -1987,7 +1987,7 @@ export class BaseInteraction<Cached extends CacheType = CacheType> extends Base
|
||||
public isMessageContextMenuCommand(): this is MessageContextMenuCommandInteraction<Cached>;
|
||||
public isModalSubmit(): this is ModalSubmitInteraction<Cached>;
|
||||
public isUserContextMenuCommand(): this is UserContextMenuCommandInteraction<Cached>;
|
||||
public isAnySelectMenu(): this is SelectMenuInteraction<Cached>;
|
||||
public isSelectMenu(): this is SelectMenuInteraction<Cached>;
|
||||
public isStringSelectMenu(): this is StringSelectMenuInteraction<Cached>;
|
||||
public isUserSelectMenu(): this is UserSelectMenuInteraction<Cached>;
|
||||
public isRoleSelectMenu(): this is RoleSelectMenuInteraction<Cached>;
|
||||
@@ -2964,8 +2964,6 @@ export class ChannelSelectMenuInteraction<
|
||||
public inRawGuild(): this is ChannelSelectMenuInteraction<'raw'>;
|
||||
}
|
||||
|
||||
// Ideally this should be named SelectMenuInteraction, but that's the name of the "old" StringSelectMenuInteraction, meaning
|
||||
// the type name is reserved as a re-export to prevent a breaking change from being made, as such:
|
||||
export type SelectMenuInteraction<Cached extends CacheType = CacheType> =
|
||||
| StringSelectMenuInteraction<Cached>
|
||||
| UserSelectMenuInteraction<Cached>
|
||||
|
||||
@@ -2399,7 +2399,7 @@ expectType<Readonly<ChannelFlagsBitField>>(threadChannel.flags);
|
||||
expectType<null>(partialGroupDMChannel.flags);
|
||||
|
||||
// Select menu type narrowing
|
||||
if (interaction.isAnySelectMenu()) {
|
||||
if (interaction.isSelectMenu()) {
|
||||
expectType<SelectMenuInteraction>(interaction);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user