Property `getString` does not exist on valid object?

d.js version: v14.13.0 node version: v18.16.0 Just quickly porting my code to windows to make sure everything is working and I noticed my VSCode is not showing me any errors, but TypeScript thinks something is wrong, nothing has changed but here is some example code.
// COMMAND.TS EXAMPLE
// NO VSCODE ERRORS FROM LINT / PRETTIER / TYPE ERRORS
async run(interaction: ChatInputCommandInteraction<'cached'>): Promise<void> {
const tt = interaction.options.getString('option', true);
console.log(tt)
}
// COMMAND.TS EXAMPLE
// NO VSCODE ERRORS FROM LINT / PRETTIER / TYPE ERRORS
async run(interaction: ChatInputCommandInteraction<'cached'>): Promise<void> {
const tt = interaction.options.getString('option', true);
console.log(tt)
}
// CONSOLE ERROR
src/interactions/owner/Settings.ts:30:40 - error TS2339: Property 'getString' does not exist on type 'Omit<CommandInteractionOptionResolver<"cached">, "getMessage" | "getFocused">'.

30 const tt = interaction.options.getString('option', true);
// CONSOLE ERROR
src/interactions/owner/Settings.ts:30:40 - error TS2339: Property 'getString' does not exist on type 'Omit<CommandInteractionOptionResolver<"cached">, "getMessage" | "getFocused">'.

30 const tt = interaction.options.getString('option', true);
9 Replies
d.js toolkit
d.js toolkit15mo 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
txj
txjOP15mo ago
CONSOLE:
No description
txj
txjOP15mo ago
CODE EDITOR:
No description
txj
txjOP15mo ago
am i missing something very dumb? Seems perhaps wrong types but ive always used these same types for the run() params
txj
txjOP15mo ago
TYPES INFERRED FROM EDITOR:
No description
treble/luna
treble/luna15mo ago
what is your ts version
txj
txjOP15mo ago
"devDependencies": {
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17",
"@types/node": "^18.18.0",
"@types/node-schedule": "^2.1.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"better-sqlite3": "^8.3.0",
"eslint": "^8.50.0",
"eslint-config-prettier": "^8.5.0",
"ts-loader": "^9.3.1",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
}
"devDependencies": {
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17",
"@types/node": "^18.18.0",
"@types/node-schedule": "^2.1.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"better-sqlite3": "^8.3.0",
"eslint": "^8.50.0",
"eslint-config-prettier": "^8.5.0",
"ts-loader": "^9.3.1",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
}
hmmge
treble/luna
treble/luna15mo ago
Update to v5.1+
txj
txjOP15mo ago
can do, ty lemme give that a run yeap that was it thank you chads, i kinda had a GigaChadGamer
Want results from more Discord servers?
Add your server