diff --git a/typings/index.d.ts b/typings/index.d.ts index e0807a606..a4e323c70 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -3326,6 +3326,7 @@ export interface BaseApplicationCommandOptionsData { name: string; description: string; required?: boolean; + autocomplete?: never; } export interface UserApplicationCommandData extends BaseApplicationCommandData { @@ -3358,7 +3359,7 @@ export interface ApplicationCommandChannelOption extends BaseApplicationCommandO channelTypes?: (keyof typeof ChannelTypes)[]; } -export interface ApplicationCommandAutocompleteOption extends BaseApplicationCommandOptionsData { +export interface ApplicationCommandAutocompleteOption extends Omit { type: | 'STRING' | 'NUMBER' @@ -3369,13 +3370,13 @@ export interface ApplicationCommandAutocompleteOption extends BaseApplicationCom autocomplete: true; } -export interface ApplicationCommandChoicesData extends BaseApplicationCommandOptionsData { +export interface ApplicationCommandChoicesData extends Omit { type: CommandOptionChoiceResolvableType; choices?: ApplicationCommandOptionChoice[]; autocomplete?: false; } -export interface ApplicationCommandChoicesOption extends BaseApplicationCommandOptionsData { +export interface ApplicationCommandChoicesOption extends Omit { type: Exclude; choices?: ApplicationCommandOptionChoice[]; autocomplete?: false; @@ -3407,7 +3408,13 @@ export interface ApplicationCommandSubGroup extends Omit { type: 'SUB_COMMAND' | ApplicationCommandOptionTypes.SUB_COMMAND; - options?: (ApplicationCommandChoicesData | ApplicationCommandNonOptionsData | ApplicationCommandChannelOptionData)[]; + options?: ( + | ApplicationCommandChoicesData + | ApplicationCommandNonOptionsData + | ApplicationCommandChannelOptionData + | ApplicationCommandAutocompleteOption + | ApplicationCommandNumericOptionData + )[]; } export interface ApplicationCommandSubCommand extends Omit { diff --git a/typings/tests.ts b/typings/tests.ts index ef693f983..0269c3770 100644 --- a/typings/tests.ts +++ b/typings/tests.ts @@ -79,6 +79,8 @@ import { User, VoiceChannel, Shard, + ApplicationCommandAutocompleteOption, + ApplicationCommandNumericOptionData, } from '.'; import type { ApplicationCommandOptionTypes } from './enums'; @@ -454,8 +456,8 @@ const baseCommandOptionData = { assertType({ ...baseCommandOptionData, type: 'STRING', - // @ts-expect-error autocomplete: true, + // @ts-expect-error choices: [], }); @@ -475,16 +477,16 @@ assertType({ assertType({ ...baseCommandOptionData, type: 'NUMBER', - // @ts-expect-error autocomplete: true, + // @ts-expect-error choices: [], }); assertType({ ...baseCommandOptionData, type: 'INTEGER', - // @ts-expect-error autocomplete: true, + // @ts-expect-error choices: [], }); @@ -893,7 +895,13 @@ declare const applicationSubCommandData: ApplicationCommandSubCommandData; // Check that only subcommands can have no subcommand or subcommand group sub-options. assertType< - | (ApplicationCommandChoicesData | ApplicationCommandNonOptionsData | ApplicationCommandChannelOptionData)[] + | ( + | ApplicationCommandChoicesData + | ApplicationCommandNonOptionsData + | ApplicationCommandChannelOptionData + | ApplicationCommandAutocompleteOption + | ApplicationCommandNumericOptionData + )[] | undefined >(applicationSubCommandData.options); }