#[TypeScript] Non required option for slash commands
19 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
you should use getString instead of .get.value and check if it's null
I don't have getString with typescript (4.9.5) :/
typeguard interaction
What ??
what kind of interaction is it? the class has a few typeguarding methods for each of them
slash command interaction
should be isChatinputCommandInteraction or something alike
Yes it is
if you already have a typeguard there you can use this type for the parameter of execute
btw you should enable strict in your tsconfig, then errors like the above would already be catched by tsc
So, else than set "strict" in tsconfig, do I need to do someting else to have the possibility to use getString ?
You need to set the parameter type of the function
strict is not for getString, it's to catch "cannot read of null" by ts
of execute function ?