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?
18 Replies
- 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! CommandInteraction#isChatInputCommand()
Indicates whether this interaction is a ChatInputCommandInteraction.
Use that typeguard
must be something wrong with my code as i dont have interaction.isChatIntputCommand
Thats... why you should add it
even with that it still gives the same error
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
made no difference still gives me the same error
if i highlight options in the deconstruction of interaction i get
but if i hightlight member it gives me GuildMember, should options be returning that type for me?
Does it also complain when you do it like that
yes
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.
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
you need to also typeguard the type of interaction
wait wtf why did the chat not scroll, nvm
Anyone have any ideas on this issue?
I have already typeguarded for chatinteraction command
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
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
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