Updated my bot to the latest version of djs

TSError: ⨯ Unable to compile TypeScript: src/Commands/Developer/emit.ts:56:27 - error TS2339: Property 'getString' does not exist on type 'Omit<CommandInteractionOptionResolver<"cached">, "getMessage" | "getFocused">'. 56 const choices = options.getString('event'); ~~~~~ at createTSError (C:\Development\DragonBot\node_modules\ts-node\src\index.ts:859:12) at reportTSError (C:\Development\DragonBot\node_modules\ts-node\src\index.ts:863:19) at getOutput (C:\Development\DragonBot\node_modules\ts-node\src\index.ts:1077:36) at Object.compile (C:\Development\DragonBot\node_modules\ts-node\src\index.ts:1433:41) at Module.m._compile (C:\Development\DragonBot\node_modules\ts-node\src\index.ts:1617:30) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Object.require.extensions.<computed> [as .ts] (C:\Development\DragonBot\node_modules\ts-node\src\index.ts:1621:12) at Module.load (node:internal/modules/cjs/loader:1117:32) at Function.Module._load (node:internal/modules/cjs/loader:958:12) at Module.require (node:internal/modules/cjs/loader:1141:19) { diagnosticCodes: [ 2339 ] } this is the line its pointing too i have tryed typeguarding with inCachedGuild(), inGuild() and neither of them work, could anyone help me out?
const choices = options.getString('event');
const choices = options.getString('event');
18 Replies
d.js toolkit
d.js toolkit16mo 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!
CanadienDragon
CanadienDragonOP16mo ago
Gist
Full Code
Full Code. GitHub Gist: instantly share code, notes, and snippets.
d.js docs
d.js docs16mo ago
chewie
chewie16mo ago
Use that typeguard
CanadienDragon
CanadienDragonOP16mo ago
must be something wrong with my code as i dont have interaction.isChatIntputCommand
chewie
chewie16mo ago
Thats... why you should add it meguFace
CanadienDragon
CanadienDragonOP16mo ago
even with that it still gives the same error
if (!interaction.isChatInputCommand()) return;
if (!interaction.isChatInputCommand()) return;
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
CanadienDragon
CanadienDragonOP16mo ago
made no difference still gives me the same error if i highlight options in the deconstruction of interaction i get
const options: Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused">
const options: Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused">
but if i hightlight member it gives me GuildMember, should options be returning that type for me?
chewie
chewie16mo ago
if (!interaction.isChatInputCommand()) return;

const option = interaction.options.getString('event');
if (!interaction.isChatInputCommand()) return;

const option = interaction.options.getString('event');
Does it also complain when you do it like that
CanadienDragon
CanadienDragonOP16mo ago
yes
CanadienDragon
CanadienDragonOP16mo ago
this is my command typings, im not sure if this will help https://gist.github.com/SkullGaming31/69681f40bea9577b0777f8fef6841528
Gist
Typeings for Commands
Typeings for Commands. GitHub Gist: instantly share code, notes, and snippets.
d.js docs
d.js docs16mo ago
To share long code snippets use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks.
CanadienDragon
CanadienDragonOP16mo ago
thats the full thing for command typings when i type options. it shows me that getString for auto Completion for my editor i think it has something to do with my command typing i removed the emit.ts and im getting errors for all commands that use options.getString
ShompiFlen
ShompiFlen16mo ago
you need to also typeguard the type of interaction wait wtf why did the chat not scroll, nvm
CanadienDragon
CanadienDragonOP16mo ago
Anyone have any ideas on this issue? I have already typeguarded for chatinteraction command
ShompiFlen
ShompiFlen16mo ago
okay so uh can you give like an update of what you have changed and what is the issue here im really trying to read but i can't understand for some reason
CanadienDragon
CanadienDragonOP16mo ago
Property 'getString' does not exist on type 'Omit<CommandInteractionOptionResolver<"cached">, "getMessage" | "getFocused">'. 56 const choices = options.getString('event'); the options from interactions is saying .getString doesnt exist. the first file i posted the link for is the emit.ts the second file is my command object, i have already typeguarded with isChatInputCommand() and its still telling me that .getString doesnt exist on interaction.options all i did was update discord to version 14.13.0 and i started getting this error
export interface ExtendedInteraction extends ChatInputCommandInteraction {
member: GuildMember;
}
interaction: ExtendedInteraction,
export interface ExtendedInteraction extends ChatInputCommandInteraction {
member: GuildMember;
}
interaction: ExtendedInteraction,
if i highlight member in the deconstruction of member it tells me its GuildMember which is done in the ExtendedInteraction, but when i highlight the options it tells me its const options: Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused"> i wounder why its not recognizing the .getString yea i even tried incachedguild that didnt work either hmm maybe its my typescript, 4.8.2 just updated my typescript, running a test now yea it was my typescript, works now, thank you so very much
Want results from more Discord servers?
Add your server