Invalid Type?

Hi, Im trying to map users from guild into a dropdown heres my code so far,
const members = await interaction.guild?.members.fetch()
if (members) {
const memberList: Array<StringSelectMenuOptionBuilder> = members.map(member => {
return new StringSelectMenuOptionBuilder({label: member.user.username, value: member.user.id})
})

const selectMenu = new StringSelectMenuBuilder({
custom_id: 'memberdropdown',
placeholder: 'Make a Selection',
max_values: 5,
options: memberList,
})
} else {
interaction.reply({content: 'There was an error while processing this request', ephemeral: true});return
}
const members = await interaction.guild?.members.fetch()
if (members) {
const memberList: Array<StringSelectMenuOptionBuilder> = members.map(member => {
return new StringSelectMenuOptionBuilder({label: member.user.username, value: member.user.id})
})

const selectMenu = new StringSelectMenuBuilder({
custom_id: 'memberdropdown',
placeholder: 'Make a Selection',
max_values: 5,
options: memberList,
})
} else {
interaction.reply({content: 'There was an error while processing this request', ephemeral: true});return
}
error:
Type 'StringSelectMenuOptionBuilder[]' is not assignable to type 'APISelectMenuOption[]'.
Type 'StringSelectMenuOptionBuilder' is missing the following properties from type 'APISelectMenuOption': label, valuets(2322)
(property) options: discord.StringSelectMenuOptionBuilder[]
Type 'StringSelectMenuOptionBuilder[]' is not assignable to type 'APISelectMenuOption[]'.
Type 'StringSelectMenuOptionBuilder' is missing the following properties from type 'APISelectMenuOption': label, valuets(2322)
(property) options: discord.StringSelectMenuOptionBuilder[]
2 Replies
d.js toolkit
d.js toolkit12mo 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! - Marked as resolved by OP
Ateeb Sohail
Ateeb SohailOP12mo ago
That exists? Oh damn Thanks
Want results from more Discord servers?
Add your server