Incorrect type in TypeScript?
I'm creating a bot with discord.js andTypeScript, so now i am creating a command with subcommands
Everything was going fine, until I tried to get the name of the subcommand, where TypeScript alerts the following error:
Property 'getSubcommand' does not exist on type 'Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused" | "getMentionable" | "getRole" | "getAttachment" | ... 6 more ... | "getSubcommand">'.ts(2339)
But, when executing this code, all run without problems... How can i solve this (without using //@ts-ignore
)
Here is the code: 2 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.OBS: The type of
int
is CommandInteraction<CacheType>
I did this, but now i have a new problem... Firstly, see my event InteractionCreate
Well, in the block await command.command(client, int, command);
i'm getting this problem when i try to convert int
(who is BaseInteraction
) to ChatInputCommandInteraction
, as my function requires
function type: (command.command(client: Discord.Client, int: ChatInputCommandInteraction, command: Command)
):