discord.js icon indicating copy to clipboard operation
discord.js copied to clipboard

Incorrect types for the ModalBuilder constructor

Open ImRodry opened this issue 2 years ago • 2 comments

Which package is this bug report for?

discord.js

Issue description

The types for the ModalBuilder constructor acceps Partial<APIModalComponent> which is wrong as this represents the components that can be inserted into a Modal (TextInput at the moment). This type should be replaced by the API type equivalent to ModalComponentData, however I could not find this on discord-api-types, which is why I'm making an issue and not a PR

Code sample

const modal = new ModalBuilder({
    label: "test" // this is valid in TS, however, it's not actually accepted by the API
})

Package version

14.1.2

Node.js version

18.7.0

Operating system

Windows 11

Priority this issue should have

Medium (should be fixed soon)

Which partials do you have configured?

Not applicable (subpackage bug)

Which gateway intents are you subscribing to?

Not applicable (subpackage bug)

I have tested this issue on a development release

No response

ImRodry avatar Aug 10 '22 18:08 ImRodry

It's a builder. So you should be able to pass some data in the constructor. And add other data using methods. So ig it's valid

imranbarbhuiya avatar Aug 10 '22 18:08 imranbarbhuiya

It's a builder. So you should be able to pass some data in the constructor. And add other data using methods. So ig it's valid

It's not valid because you can't pass data used to construct a TextInputComponent to a ModalBuilder, that's the issue here

ImRodry avatar Aug 10 '22 20:08 ImRodry