I was trying to send components using a basic send function from a sendable channel.
The docs says I can send an array of ActionRowBuilder which is what I am trying to do but I get a TS error.
When looking at the typings we can see that components from BaseMessageOptions doesn't have ActionRowBuilder as option.
Are the types or the docs wrong? Or am I missing something?
#TS Inconsistency for message components
6 messages · Page 1 of 1 (latest)
- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- 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
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)
If you showed the ts error you‘ve gotten this would’ve been easier btw