I am having trouble wording this, however I have this:
//type ApplicationCommandData = UserApplicationCommandData | MessageApplicationCommandData | ChatInputApplicationCommandData
// (from discord.js)
type Foo = ApplicationCommandData | Bar;
interface Bar extends ChatInputApplicationCommandData {
options?: readonly Exclude<
ApplicationCommandOptionData,
{
type:
| ApplicationCommandOptionType.SubcommandGroup
| ApplicationCommandOptionType.Subcommand;
}
>[];
handler(interaction: ChatInputCommandInteraction): Promise<void> | void;
}
function defineFoo(foo: Foo) {
return foo;
}
defineFoo({
name: "test",
description: "test",
options: [
{
type: ApplicationCommandOptionType.SubcommandGroup,
name: "test",
description: "test",
options: [],
},
],
handler(interaction) {},
});
Why is options allowed to have SubcommandGroup, when Bar is the only type with handler() and it does not allow SubcommandGroup?