member is of type 'unknown'

I'm building a command in typescript, and have the following:
const members = await interaction.guild.members.fetch();
console.log(members);
for (const [id, member] of Object.entries(members)) {
console.log(member.roles);
}
const members = await interaction.guild.members.fetch();
console.log(members);
for (const [id, member] of Object.entries(members)) {
console.log(member.roles);
}
The first console.log(members) works fine but the second line gives me the error member is of type 'unknown', how do I fix this/move forward?
4 Replies
d.js toolkit
d.js toolkit15mo 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!
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Tyranasaurus
TyranasaurusOP15mo ago
Thank you!! yep that did it. You'd think I'd understand JS by now after coding in it for 4 years....
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server