Can't create a modal component

Hi, Getting this error whil creating a modal component
Argument of type '[ActionRowBuilder<AnyComponentBuilder>]' is not assignable to parameter of type 'RestOrArray<ActionRowBuilder<TextInputBuilder>>'.
Type '[ActionRowBuilder<AnyComponentBuilder>]' is not assignable to type '[ActionRowBuilder<TextInputBuilder>[]]'.
Type 'ActionRowBuilder<AnyComponentBuilder>' is missing the following properties from type 'ActionRowBuilder<TextInputBuilder>[]': length, pop, push, concat, and 29 more.ts(2345)
Argument of type '[ActionRowBuilder<AnyComponentBuilder>]' is not assignable to parameter of type 'RestOrArray<ActionRowBuilder<TextInputBuilder>>'.
Type '[ActionRowBuilder<AnyComponentBuilder>]' is not assignable to type '[ActionRowBuilder<TextInputBuilder>[]]'.
Type 'ActionRowBuilder<AnyComponentBuilder>' is missing the following properties from type 'ActionRowBuilder<TextInputBuilder>[]': length, pop, push, concat, and 29 more.ts(2345)
const modal = new ModalBuilder()
.setCustomId(`modal-create-${ticketType}-`)
.setTitle(`title`)
.setComponents(
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setCustomId("modal-input-input")
.setLabel(`What would you like to say to us ?`)
.setStyle(TextInputStyle.Paragraph)
)
)

await interaction.showModal(modal);
const modal = new ModalBuilder()
.setCustomId(`modal-create-${ticketType}-`)
.setTitle(`title`)
.setComponents(
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setCustomId("modal-input-input")
.setLabel(`What would you like to say to us ?`)
.setStyle(TextInputStyle.Paragraph)
)
)

await interaction.showModal(modal);
3 Replies
d.js toolkit
d.js toolkit•2mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - ✅ Marked as resolved by OP
d.js docs
d.js docs•2mo ago
In TypeScript the ActionRowBuilder class has a generic type parameter that specifies the type of component the action row holds:
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(button)
const row = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(selectMenu)
const row = new ActionRowBuilder<TextInputBuilder>().addComponents(textInput)
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(button)
const row = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(selectMenu)
const row = new ActionRowBuilder<TextInputBuilder>().addComponents(textInput)
kps
kps•2mo ago
Thank you so much :)
Want results from more Discord servers?
Add your server