#Builders 1.10.1 > 1.11.x causes errors

40 messages · Page 1 of 1 (latest)

woeful lily
#

I'm by no means a TS wizard, but I try.

In one of my apps, I create a clear button that I pass around and is made available throughout the code. It's effectively a button that when hit, will delete/'close' the message it's attached to.

I create it in my interactionCreate listener like this:

const clear = new ActionRowBuilder<ButtonBuilder>().addComponents([new ButtonBuilder().setCustomId('botMessageClose').setLabel('❌ Close').setStyle(ButtonStyle.Success)]);

I've been doing it this way for a long time without issue.

Today, whilst having an unrelated issue with zlib-sync not installing on my MacBook, I tried to troubleshoot and in the process, I deleted node_modules and the package-lock file. The issue didn't resolve, but as a side effect, it meant the builders dependency for discord.js got bumped from 1.10.1 to 1.11.0 (and then 1.11.1 a short while ago).

This immediately flooded my app with errors, 172 specifically. Looking at it closer I see that every single one of them related to an issue with ActionRowBuilder<ButtonBuilder> no longer satisfying the type requirements for the components array of a message/interaction response.

Downgrading the dependency back to 1.10.1 removed all the errors immediately.

I'd rather be up to date, so I have no issue with 'fixing' my code to accommodate whatever specific type changes were made, but I struggle to see what was changed to cause the error, given how the existing components are fundamentally unchanged.

This is the error I get when using 1.11. with my above code:

Type 'ActionRowBuilder<ButtonBuilder>[]' is not assignable to type 'readonly (APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>)[]'.
  Type 'ActionRowBuilder<ButtonBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
    Property 'type' is missing in type 'ActionRowBuilder<ButtonBuilder>' but required in type 'ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>'.ts(2322)
index.d.mts(301, 3): 'type' is declared here.
(property) components?: readonly (APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>)[]

Any input or advice would be greatly appreciated.

gleaming tokenBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • 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!
frank pike
#

you aren't meant to install builders separately, you should use the one that's re-exported by djs

woeful lily
#

I never said I was installing it seperately

frank pike
#

are you sure you're on latest djs? from what I recall builders should be pinned

#

which is why I assumed you installed it separately

woeful lily
frank pike
#

hmm what about discord-api-types?

woeful lily
#

thats after deleting node_modules and package-lock again for a clean install

frank pike
#

and you're passing that row to components: [row] right?

woeful lily
#

thats right

frank pike
#

can't see anything particularly wrong, maybe someone else can

woeful lily
#

thanks for your input though

frank pike
#

uh I actually misread the error, it's not even a dtypes missmatch

#

it says type is missing?

#

that version released a while ago so it could be possible that that's an oversight

#

the team is releasing and fixing a bunch of versions so it's possible there's a bug and it'll be fixed soon

#

talking with the team, it should be fixed soon in next djs

#

caught them in the middle of a release train

woeful lily
#

I wanted to believe it could be a bug, but I was also just as sure it could be a mistake by me which is why I made the post. I'll wait to see if Qjuh or any of the maintainers make a comment in here given their hands on work with this

frank pike
#

from a maintainer

frank pike
#

no idea what caused it in the first place but apparently it's fixed so :shrug:

woeful lily
frank pike
# frank pike

oops didn't forward the "this works with current state of the branch" (not released)

woeful lily
#

that works?

frank pike
#

I don't think there's any more changes pending to builders

#

unless a bug is spotted ofc, but this one seems to be fixed

woeful lily
#

eh, installing versions of packages that aren't already published to npm is outside of what I've messed with in the past. I'll trust that it's being fixed and stick with 14.18.0 and 1.10.1 for now

#

thanks for the help though, its much appreciated

frank pike
woeful lily
#

once a new version is released with the fix included, I'll definitely be trying it to confirm it's working 🙂

frank pike
#

it's released though, #announcements

woeful lily
#

I looked 3 minutes ago, when I typed my message, and neither github or npmjs was showing a new version

#

I see it now though 🙂

#

and can confirm no errors, working as intended