"ApplicationCommandType.User" is not assignable to parameter of type "ContextMenuCommandType"

I'm using discord.js with Typescript and I encounter the error TS2345: Argument of type ApplicationCommandType.User is not assignable to parameter of type ContextMenuCommandType

But if I look in the type definition I can see type ContextMenuCommandType = ApplicationCommandType.Message | ApplicationCommandType.User;

Code

const commandType = ApplicationCommandType.User;
return new ContextMenuCommandBuilder()
     .setType(commandType);


Versions

  • Node :white_right_arrow: 20.16.0
  • discordjs :white_right_arrow: 14.16.3
  • discord-api-types :white_right_arrow: 0.37.103 (installed as dev dependencies)
  • Typescript :white_right_arrow: 5.6.3
Was this page helpful?