From 537631d4881d5a46dd1cccab9f63a02bd31ad89f Mon Sep 17 00:00:00 2001 From: MARCROCK22 Date: Sun, 27 Oct 2024 04:39:31 +0000 Subject: [PATCH] fix: dont use ToClass --- src/builders/SelectMenu.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/builders/SelectMenu.ts b/src/builders/SelectMenu.ts index dff1792..8990594 100644 --- a/src/builders/SelectMenu.ts +++ b/src/builders/SelectMenu.ts @@ -1,11 +1,10 @@ -import type { EmojiResolvable, RestOrArray, ToClass } from '../common'; +import type { EmojiResolvable, RestOrArray } from '../common'; import { resolvePartialEmoji } from '../common/it/utils'; import type { ChannelSelectMenuInteraction, ComponentInteraction, MentionableSelectMenuInteraction, RoleSelectMenuInteraction, - StringSelectMenuInteraction, UserSelectMenuInteraction, } from '../structures'; import { @@ -53,9 +52,6 @@ function mappedDefault( * const selectMenu = new SelectMenu(); * selectMenu.setCustomId("user-select-menu"); * selectMenu.setPlaceholder("Select a user"); - * selectMenu.run((interaction) => { - * // Handle select menu interaction - * }); */ export class SelectMenu< Select extends APISelectMenuComponent = APISelectMenuComponent, @@ -273,14 +269,12 @@ export class ChannelSelectMenu extends SelectMenu, 'data' | 'toJSON'>, - StringSelectMenu ->) { +export class StringSelectMenu extends SelectMenu { + //@ts-expect-error declare data: Omit & { options: StringSelectOption[] }; constructor(data: Partial = {}) { super({ ...data, type: ComponentType.StringSelect }); - this.data.options = (data.options ?? []).map(x => new StringSelectOption(x)); + this.data.options = data.options?.map(x => new StringSelectOption(x)) ?? []; } /** @@ -307,7 +301,7 @@ export class StringSelectMenu extends (SelectMenu as unknown as ToClass< const { options, ...raw } = this.data; return { ...raw, - options: this.data.options.map(x => x.toJSON()), + options: options.map(x => x.toJSON()), }; } }