ActionRowBuilder type in interaction.reply component

Hello, I'm creating a typescript discord handler and want to try the buttons, however I have a typing error. I looked at the doc and it's well written. Do you have a solution to my problem? note: the CommandContext is the same as the ChatInputInteractionCommand, but with additional methods, the reply method is a copy with the same options as in the package.
execute(client: ExtendsClient, ctx: CommandContext) {
const click = new ButtonBuilder()
.setCustomId("btn1")
.setLabel("Click")
.setStyle(ButtonStyle.Primary)

const row = new ActionRowBuilder()
.addComponents(click);
ctx.reply({content: "Click sur le bouton pour essayer l'event :", components: [row]})
}
execute(client: ExtendsClient, ctx: CommandContext) {
const click = new ButtonBuilder()
.setCustomId("btn1")
.setLabel("Click")
.setStyle(ButtonStyle.Primary)

const row = new ActionRowBuilder()
.addComponents(click);
ctx.reply({content: "Click sur le bouton pour essayer l'event :", components: [row]})
}
Type 'ActionRowBuilder<AnyComponentBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
Property 'type' is missing in type 'ActionRowBuilder<AnyComponentBuilder>' but required in type 'ActionRowData<MessageActionRowComponentBuilder | MessageActionRowComponentData>'.
Type 'ActionRowBuilder<AnyComponentBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
Property 'type' is missing in type 'ActionRowBuilder<AnyComponentBuilder>' but required in type 'ActionRowData<MessageActionRowComponentBuilder | MessageActionRowComponentData>'.
4 Replies
d.js toolkit
d.js toolkit17mo 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!
d.js docs
d.js docs17mo ago
Tag suggestion for @kuracho: 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)
Max
MaxOP17mo ago
ohh okayy i see thanks i go try it oh nice thanks you ! ^^
ifml
ifml17mo ago
Dmi
Want results from more Discord servers?
Add your server