Please describe the problem you are having in as much detail as possible:
TypeError: newParent.permissionOverwrites.map is not a function error when calling the <Channel>.setParent function
Steps to reproduce
Create a new channel
Try updating the parent (\<Channel>.setParent())
Include a reproducible code sample here, if possible:
import { OverwriteResolvable, Permissions, Snowflake } from "discord.js";
const DEFAULT_PERMS: OverwriteResolvable[] = [
{
id: message.author.id,
allow: [Permissions.FLAGS.VIEW_CHANNEL, Permissions.FLAGS.SEND_MESSAGES],
},
{
id: this.bot.user.id,
allow: [Permissions.FLAGS.VIEW_CHANNEL, Permissions.FLAGS.SEND_MESSAGES],
},
{
id: message.guild?.roles.everyone.id!,
deny: [Permissions.FLAGS.VIEW_CHANNEL],
},
];
const channel = await message.guild?.channels.create(
"ticket",
{
type: "text",
nsfw: false,
permissionOverwrites: DEFAULT_PERMS,
},
);
/**
ERROR here:
TypeError: newParent.permissionOverwrites.map is not a function
at TextChannel.edit (/home/casper/Projects/personal/ghostybot/node_modules/discord.js/src/structures/GuildChannel.js:313:66)
at TextChannel.setParent (/home/casper/Projects/personal/ghostybot/node_modules/discord.js/src/structures/GuildChannel.js:375:17)
*/
if (dbGuild.ticket_data.parent_id !== null) {
channel.setParent(guild.ticket_data.parent_id as Snowflake);
}
Further details:
Full error:
TypeError: newParent.permissionOverwrites.map is not a function
at TextChannel.edit (/home/casper/Projects/personal/ghostybot/node_modules/discord.js/src/structures/GuildChannel.js:313:66)
at TextChannel.setParent (/home/casper/Projects/personal/ghostybot/node_modules/discord.js/src/structures/GuildChannel.js:375:17)
at CreateTicketCommand.execute (/home/casper/Projects/personal/ghostybot/src/commands/ticket/createticket.ts:83:18)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
This very valid bug report aside:
GuildChannel#edit allows a parentID as part of the ChannelData, making the call to GuildChannel#setParent a superfluous API request.
Please describe the problem you are having in as much detail as possible:
TypeError: newParent.permissionOverwrites.map is not a function error when calling the
<Channel>.setParent
functionSteps to reproduce
Include a reproducible code sample here, if possible:
Further details:
Full error:
Full command here
Error stack leads to: https://github.com/discordjs/discord.js/blob/610b0b4dd6b6e66c05c22eb852d2a752b99d07ba/src/structures/GuildChannel.js#L313
610b0b4dd6b6e66c05c22eb852d2a752b99d07ba
Relevant client options:
partials:
gateway intents: