diff --git a/packages/discord.js/src/structures/ModalSubmitInteraction.js b/packages/discord.js/src/structures/ModalSubmitInteraction.js index f10eb476d..8f0ccf16c 100644 --- a/packages/discord.js/src/structures/ModalSubmitInteraction.js +++ b/packages/discord.js/src/structures/ModalSubmitInteraction.js @@ -88,12 +88,13 @@ class ModalSubmitInteraction extends BaseInteraction { * @returns {ModalData[]} */ static transformComponent(rawComponent) { - return { - value: rawComponent.value, - type: rawComponent.type, - customId: rawComponent.custom_id, - components: rawComponent.components?.map(c => this.transformComponent(c)), - }; + return rawComponent.components + ? { type: rawComponent.type, components: rawComponent.components.map(c => this.transformComponent(c)) } + : { + value: rawComponent.value, + type: rawComponent.type, + customId: rawComponent.custom_id, + }; } /** diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 87c47c465..2c48378b8 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2228,17 +2228,15 @@ export interface TextInputModalData extends BaseModalData { export interface ActionRowModalData { type: ComponentType.ActionRow; - components: ModalData[]; + components: TextInputModalData[]; } -export type ModalData = TextInputModalData | ActionRowModalData; - export class ModalSubmitFields { constructor(components: ModalActionRowComponent[][]); - public components: ActionRow; + public components: ActionRowModalData[]; public fields: Collection; - public getField(customId: string, type: T): { type: T } & ModalData; - public getField(customId: string, type?: ComponentType): ModalData; + public getField(customId: string, type: T): { type: T } & TextInputModalData; + public getField(customId: string, type?: ComponentType): TextInputModalData; public getTextInputValue(customId: string): string; }