Builders 1.10.1 > 1.11.x causes errors

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)]);
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<...>)[]
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.
23 Replies
d.js toolkit
d.js toolkit14h ago
- 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!
Amgelo
Amgelo14h ago
you aren't meant to install builders separately, you should use the one that's re-exported by djs
sludge
sludgeOP14h ago
I never said I was installing it seperately
Amgelo
Amgelo14h ago
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
sludge
sludgeOP14h ago
npm ls discord.js

npm ls @discordjs/builders
└── @discordjs/[email protected]
npm ls discord.js

npm ls @discordjs/builders
└── @discordjs/[email protected]
Amgelo
Amgelo14h ago
hmm what about discord-api-types?
sludge
sludgeOP14h ago
npm ls discord-api-types
├─┬ @discordjs/[email protected]
│ └── [email protected]
├─┬ @discordjs/[email protected]
│ └── [email protected]
├─┬ @discordjs/[email protected]
│ └── [email protected]
├─┬ @discordjs/[email protected]
│ └── [email protected]
npm ls discord-api-types
├─┬ @discordjs/[email protected]
│ └── [email protected]
├─┬ @discordjs/[email protected]
│ └── [email protected]
├─┬ @discordjs/[email protected]
│ └── [email protected]
├─┬ @discordjs/[email protected]
│ └── [email protected]
thats after deleting node_modules and package-lock again for a clean install
Amgelo
Amgelo14h ago
and you're passing that row to components: [row] right?
sludge
sludgeOP14h ago
thats right
Amgelo
Amgelo14h ago
can't see anything particularly wrong, maybe someone else can
sludge
sludgeOP14h ago
thanks for your input though
Amgelo
Amgelo14h ago
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
sludge
sludgeOP13h ago
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
Amgelo
Amgelo13h ago
from a maintainer ^^ no idea what caused it in the first place but apparently it's fixed so :shrug:
sludge
sludgeOP13h ago
sorry! I didn't spot this, thank you 🙂
Amgelo
Amgelo13h ago
oops didn't forward the "this works with current state of the branch" (not released)
sludge
sludgeOP13h ago
I wonder if that means it will be fixed in 1.11.2 or if it's meant to have already been fixed in 1.11.1 that works?
Amgelo
Amgelo13h ago
should mean that you'll have to bump djs once it releases and it should work 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
sludge
sludgeOP13h ago
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
Amgelo
Amgelo12h ago
should be fixed, can you try after updating?
sludge
sludgeOP12h ago
once a new version is released with the fix included, I'll definitely be trying it to confirm it's working 🙂
Amgelo
Amgelo12h ago
it's released though, #announcements
sludge
sludgeOP11h ago
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 quite a relief to know it wasn't a me issue

Did you find this page helpful?