Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionRowBuilder<T> does not seem to enforce the type of the components to be T #10259

Open
Ptitet opened this issue May 6, 2024 · 1 comment

Comments

@Ptitet
Copy link

Ptitet commented May 6, 2024

Which package is this bug report for?

builders

Issue description

When building an ActionRow with ActionRowBuilder, the type parameter passed does not seem to enforce the components to be of the type passed.
I tested it in VSCode and got no error from IntelliSense :
image

Code sample

const actionRow = new ActionRowBuilder<StringSelectMenuBuilder>({
    components: [
        new ButtonBuilder({/* ... */}); // no error from IntelliSense
    ]
});

Versions

  • discord.js 14.15.2
  • Node.js 20.12.2
  • TypeScript 5.4.5
  • Linux Mint 21.3

Issue priority

Low (slightly annoying)

Which partials do you have configured?

Not applicable

Which gateway intents are you subscribing to?

Not applicable

I have tested this issue on a development release

No response

@monbrey
Copy link
Member

monbrey commented May 6, 2024

This behaviour only applies to the constructor, which is inherited. We may still be able to address it though.

If you require a solution before a fix is applied, the .addComponents method is type-safe:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants