ChatInputCommandInteraction options problem

Hi, I got little type related problem with getting the ChatInputCommandInteraction options. The problem appeared when I updated discord.js to 14.14.1 from 14.11.0. Here's the code:
const getEvalMessagePayload = async (client: ExtendedClient, interaction: ChatInputCommandInteraction) => {
const code = interaction.options.getString(`code`);
const depth = interaction.options.getInteger(`depth`);

const embed = new EmbedBuilder();
try {
const result = await eval(code ?? '');
const output = await clean(result, depth ?? 0);

embed
.setTitle(i18n.__("evaluation.title"))
.setDescription(`**${i18n.__("evaluation.input")}**\n\`\`\`js\n${code}\n\`\`\`\n**${i18n.__("evaluation.output")}**\n\`\`\`js\n${output}\n\`\`\``)
.setColor('Blurple');
} catch (e) {
embed
.setTitle(i18n.__("evaluation.title"))
.setDescription(`**${i18n.__("evaluation.input")}**\n\`\`\`js\n${code}\n\`\`\`\n**${i18n.__("evaluation.output")}**\n\`\`\`js\n${e}\n\`\`\``)
.setColor('Red');
}

return {
embeds: [embed]
}
};
const getEvalMessagePayload = async (client: ExtendedClient, interaction: ChatInputCommandInteraction) => {
const code = interaction.options.getString(`code`);
const depth = interaction.options.getInteger(`depth`);

const embed = new EmbedBuilder();
try {
const result = await eval(code ?? '');
const output = await clean(result, depth ?? 0);

embed
.setTitle(i18n.__("evaluation.title"))
.setDescription(`**${i18n.__("evaluation.input")}**\n\`\`\`js\n${code}\n\`\`\`\n**${i18n.__("evaluation.output")}**\n\`\`\`js\n${output}\n\`\`\``)
.setColor('Blurple');
} catch (e) {
embed
.setTitle(i18n.__("evaluation.title"))
.setDescription(`**${i18n.__("evaluation.input")}**\n\`\`\`js\n${code}\n\`\`\`\n**${i18n.__("evaluation.output")}**\n\`\`\`js\n${e}\n\`\`\``)
.setColor('Red');
}

return {
embeds: [embed]
}
};
Here are the errors:
TS2339: Property getString does not exist on type
Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused">
TS2339: Property getString does not exist on type
Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused">
TS2339: Property getInteger does not exist on type
Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused">
TS2339: Property getInteger does not exist on type
Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused">
The code runs fine and does what it should but Typescript throws this errors that I want to get rid of.
9 Replies
d.js toolkit
d.js toolkit8mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Syjalo
Syjalo8mo ago
Restart TS server or reopen the editor window
emigrek
emigrekOP8mo ago
Doesnt work
emigrek
emigrekOP8mo ago
Another thing is when I jump to the typedefs, my IDE is throwing errors on almost entire get options types:
No description
emigrek
emigrekOP8mo ago
the interaction.options.getBoolean method however works fine
Syjalo
Syjalo8mo ago
What is your Typescript version?
emigrek
emigrekOP8mo ago
4.9.5 its not an IDE problem, I checked this in VS code and its the same
Syjalo
Syjalo8mo ago
Iirc our minimum version is 5.2
emigrek
emigrekOP8mo ago
OK, i'll update soon It works, thanks for help <3
Want results from more Discord servers?
Add your server