Error ActionRowBuilder() and TypeScript

const avanzarDis = new ButtonBuilder()
.setCustomId("avanzar")
.setLabel(">")
.setStyle(ButtonStyle.Primary)
.setDisabled(true);
const retrocederDis = new ButtonBuilder()
.setCustomId("retroceder")
.setLabel("<")
.setStyle(ButtonStyle.Primary)
.setDisabled(true);

const row = new ActionRowBuilder().addComponents([
retrocederDis,
avanzarDis,
]);

const filter = (i: any) => i.user.id === interaction.user.id;

const res = await interaction.reply({
embeds: [embed],
components: [row], <-- ERROR HERE
});
const avanzarDis = new ButtonBuilder()
.setCustomId("avanzar")
.setLabel(">")
.setStyle(ButtonStyle.Primary)
.setDisabled(true);
const retrocederDis = new ButtonBuilder()
.setCustomId("retroceder")
.setLabel("<")
.setStyle(ButtonStyle.Primary)
.setDisabled(true);

const row = new ActionRowBuilder().addComponents([
retrocederDis,
avanzarDis,
]);

const filter = (i: any) => i.user.id === interaction.user.id;

const res = await interaction.reply({
embeds: [embed],
components: [row], <-- ERROR HERE
});
4 Replies
d.js toolkit
d.js toolkit15mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
XurxoMF
XurxoMF15mo ago
Error:
Ninguna sobrecarga coincide con esta llamada.
La sobrecarga 1 de 2, "(options: InteractionReplyOptions & { fetchReply: true; }): Promise<Message<boolean>>", dio el error siguiente.
El tipo 'ActionRowBuilder<AnyComponentBuilder>' no se puede asignar al tipo 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
La propiedad "type" falta en el tipo "ActionRowBuilder<AnyComponentBuilder>", pero es obligatoria en el tipo "ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>".
La sobrecarga 2 de 2, "(options: string | InteractionReplyOptions | MessagePayload): Promise<InteractionResponse<boolean>>", dio el error siguiente.
El tipo 'ActionRowBuilder<AnyComponentBuilder>' no se puede asignar al tipo 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.ts(2769)
index.d.ts(268, 3): "type" se declara aquí.
const row: ActionRowBuilder<AnyComponentBuilder>
Ninguna sobrecarga coincide con esta llamada.
La sobrecarga 1 de 2, "(options: InteractionReplyOptions & { fetchReply: true; }): Promise<Message<boolean>>", dio el error siguiente.
El tipo 'ActionRowBuilder<AnyComponentBuilder>' no se puede asignar al tipo 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
La propiedad "type" falta en el tipo "ActionRowBuilder<AnyComponentBuilder>", pero es obligatoria en el tipo "ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>".
La sobrecarga 2 de 2, "(options: string | InteractionReplyOptions | MessagePayload): Promise<InteractionResponse<boolean>>", dio el error siguiente.
El tipo 'ActionRowBuilder<AnyComponentBuilder>' no se puede asignar al tipo 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.ts(2769)
index.d.ts(268, 3): "type" se declara aquí.
const row: ActionRowBuilder<AnyComponentBuilder>
It says that I cannot apply the ActionRowBuilder<AnyComponentBuilder> to APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...> I followed the discord.js guide but TypeScript detects it wrong I can set type any to the row and errors out but I want to know if I'm doing something wrong(or how to solve it)
d.js docs
d.js docs15mo 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)
XurxoMF
XurxoMF15mo ago
Ohhh, okok. I'm +- new to ts and I don't know everything sorry ;-; Thx a lot for the help <a:av_besitos:1114871486419832852>
Want results from more Discord servers?
Add your server