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 toolkit3mo 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
Syjalo3mo ago
Restart TS server or reopen the editor window
emigrek
emigrek3mo ago
Doesnt work
emigrek
emigrek3mo ago
Another thing is when I jump to the typedefs, my IDE is throwing errors on almost entire get options types:
No description
emigrek
emigrek3mo ago
the interaction.options.getBoolean method however works fine
Syjalo
Syjalo3mo ago
What is your Typescript version?
emigrek
emigrek3mo ago
4.9.5 its not an IDE problem, I checked this in VS code and its the same
Syjalo
Syjalo3mo ago
Iirc our minimum version is 5.2
emigrek
emigrek3mo ago
OK, i'll update soon It works, thanks for help <3