-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
Subcommands keys aren't typechecked.
{
schema: new SlashCommandBuilder()
.setName('myCommand')
.addSubcommand((subcommand) =>
subcommand.setName('subcommand1').setDescription('do 1'),
)
.addSubcommand((subcommand) =>
subcommand
.setName('subcommand2')
.setDescription('do 2'),
)
.toJSON(),
handler: {
somethingNotLegit: async (interaction) => {},
anyKeyCanBeHere: async (interaction) => {},
// ^ ------------ Not legit
},
}
Solution
Override the type of schema
with subcommands strings as const (or check if they aren't in the type already). Then retrieve the subcommands keys with a type helper.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request