CarelessInternet
CarelessInternet
DIAdiscord.js - Imagine an app
Created by CarelessInternet on 11/16/2023 in #djs-questions
ActionRowBuilder type error
Any idea why this I'm getting this type error? It's the components array that is complaining. The components type works fine with other types of SelectMenuBuilders.
Type 'ActionRowBuilder<ChannelSelectMenuBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
Property 'type' is missing in type 'ActionRowBuilder<ChannelSelectMenuBuilder>' but required in type 'ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>'.ts(2322)
index.d.ts(280, 3): 'type' is declared here.

const row: ActionRowBuilder<ChannelSelectMenuBuilder>
Type 'ActionRowBuilder<ChannelSelectMenuBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
Property 'type' is missing in type 'ActionRowBuilder<ChannelSelectMenuBuilder>' but required in type 'ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>'.ts(2322)
index.d.ts(280, 3): 'type' is declared here.

const row: ActionRowBuilder<ChannelSelectMenuBuilder>
const channelMenu = new ChannelSelectMenuBuilder()
.setCustomId('test')
.setPlaceholder('select a channel')
.setMinValues(1)
.setMaxValues(1)
.setChannelTypes(ChannelType.GuildText);

const row = new ActionRowBuilder<ChannelSelectMenuBuilder>().setComponents(channelMenu);

return interaction.editReply({ content: 'hello', components: [row] });
const channelMenu = new ChannelSelectMenuBuilder()
.setCustomId('test')
.setPlaceholder('select a channel')
.setMinValues(1)
.setMaxValues(1)
.setChannelTypes(ChannelType.GuildText);

const row = new ActionRowBuilder<ChannelSelectMenuBuilder>().setComponents(channelMenu);

return interaction.editReply({ content: 'hello', components: [row] });
7 replies