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:
Danial Raza
2024-12-12 11:21:00 +01:00
committed by GitHub
parent 89940d55e3
commit fd1958bd67
3 changed files with 3 additions and 5 deletions

View File

@@ -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);
}

View File

@@ -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>

View File

@@ -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);
}