Type error making a select
I was trying to implement a select as I have shown in:
https://discordjs.guide/message-components/select-menus.html#building-string-select-menus
I am not using SlashCommands and to see how it works, I made a simple code coping the example:
As you can see I am using typescript and the problem is in:
row give me the next type error:
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>'.ts(2322)
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
4 Replies
- 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!Originally I was using:
- @discordjs/builders: ^1.7.0
- @discordjs/opus: ^0.9.0
- @discordjs/rest: ^1.7.1
- discord-api-types: ^0.26.1
- discord.js: ^13.17.1
I updated discord.js to 14.14.1 version and removed the other dependencies as suggested in the docs, to see if that fixes the issues, but the error is still there.
Node v: 20.11.0
In TypeScript the
ActionRowBuilder
class has a generic type parameter that specifies the type of component the action row holds:
Oh perfect, it works, thanks you very much.
Out of curiosity, this is something implemented after the v13.17, doesn't it? Until now I have implemented "Button Builder" and "TextInputBuilder" without using "ActionRowBuilder".
Finally, selects can be used correctly in v13.17, doesn't it? Or I must update the version?
I was thinking about it, but I don't have a lot leisure, now the bot is working almost perfectly. Make some improve is one thing, update the version of the bot is another thing. I have seen that are a lot of type incompatibilities, XD
But I will eventually.
Anyway, thank you very much for your time and attendance!