Validation error in `SlashCommandBuilder.addSubcommand`
I'm registering a command with a single sub command as such (pardon the poor indentation, copying to Discord is... annoying)
It's throwing the following error attached in the screenshot. I have no TS errors and I'm not quite sure what's wrong here.
![No description](https://cdn.answeroverflow.com/1246862584460738620/image.png)
Solution:Jump to solution
instead of importing the functions just pass the builder callback:
```ts
registry.registerChatInputCommand((builder) =>
builder
.setName('leaderboards') //...
14 Replies
Solution
instead of importing the functions just pass the builder callback:
Yeah this is it... Why do TS types accept the respective builder instances though? By the way @Answer Overflow isn't working atm
@vladdy looks like
SlashCommandStringOption
doesnt get recognised as something that has to be built, and calling .toJSON()
gives the TS error
@Rhys, @Answer Overflow is giving application did not respondthats weird, the validators should work
TS types say it should accept the instance directly so I assumed I could
yeah bc it should work
maybe I did an oopsie?
either that or DiscordJS did in /builders
aka me
(to be fair shapeshift doesnt have function validators yet and when I tried to add them I failed hard)
but this is an instanceof check
oh right it's a class mb
and also ??? it doesnt get transformed anywhere
the heck
yeah that is strange
Full stack trace in case it helps and version info -
@sapphire/plugin-subcommands@6.0.3
@sapphire/framework@5.2.1
discord.js@14.15.2
Weird, sorry about that looks like it’s back now