PermissionOverwrites doesn’t have function edit/create in discord.js?

I was following a page on the discord.js website, but after copying exactly what it says, I get an error:

TypeError: message.channel.permissionOverwrites.create is not a function

message.channel.permissionOverwrites.create(message.channel.guild.roles.everyone, {
    VIEW_CHANNEL: false
});

Above is the code.

Answer

Seem like you are using discord.js v12, but reading docs for v13 (current stable branch). See here for the right docs.

In discord.js v12 use GuildChannel.updateOverwrite() or GuildChannel.createOverwrite().

message.channel.updateOverwrite(message.channel.guild.roles.everyone, {
    VIEW_CHANNEL: false
});

Tested using discord.js ^12.5.3.