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

types(ModalSubmitFields): components is an array

Open ImRodry opened this issue 2 years ago • 7 comments

Please describe the changes this PR makes and why it should be merged:

This PR simply fixes an issue in ModalSubmitFields#components as it wasn't marked as an array and instead was simply an action row

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

ImRodry avatar Apr 16 '23 22:04 ImRodry

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Apr 16, 2023 10:47pm
discord-js-guide ⬜️ Ignored (Inspect) Apr 16, 2023 10:47pm

vercel[bot] avatar Apr 16 '23 22:04 vercel[bot]

Oh cool you're using teams now, just fyi github only officially assigns 2 members of the team at a time despite you all appearing on the side

ImRodry avatar Apr 16 '23 22:04 ImRodry

I didn't notice but yeah the type is wrong however I don't think that one is right either because that one technically indicates that you can chain components.components infinitely, despite the actual TextInputComponent object coming with a components property set to undefined. Should I just use that type and ignore this?

ImRodry avatar Apr 16 '23 22:04 ImRodry

The types should match what the JS code is, unless the JS code is somehow wrong and has been for a year.

kyranet avatar Apr 16 '23 22:04 kyranet

The only thing "wrong" about the JS code is the fact that components is set as undefined on text input objects. I'll try to modify the types a little to match that

ImRodry avatar Apr 16 '23 22:04 ImRodry

Also I know how to fix that issue, can I include that in this PR?

ImRodry avatar Apr 16 '23 22:04 ImRodry

Pushed both the types change and a small change to the transformComponent function that should get rid of all the undefined properties to align it with the data returned by the API and the TS types. If you want me to remove that commit or move it to a different PR lmk

ImRodry avatar Apr 16 '23 22:04 ImRodry