[TypeScript] Non required option for slash commands
Hello !
I wanted to know, I rewrite my bot with TypeScript and I have a problem. When I want to get the value of non-required option, my bot crash.
The concerned line (37) :
let version = interaction.options.get('version', false).value as string;
Thanks in advance ^^
Mysterious_Dev
9 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I don't have getString with typescript (4.9.5) :/

What ??
slash command interaction
Yes it is

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
of execute function ?

Thanks ! I forgot I created that an interface for slash command (parameter typed with CommandInteraction insteadof ChatInputCommandInteraction). Sorry for the inconvenience ^^'.