Skip to content

Commit

Permalink
types(ApplicationCommandData): Stronger typings for `ApplicationComma…
Browse files Browse the repository at this point in the history
…ndData` variants. (#6382)
  • Loading branch information
suneettipirneni authored Aug 11, 2021
1 parent de3c86f commit 75b48d8
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2881,14 +2881,30 @@ export interface ApplicationAsset {
type: 'BIG' | 'SMALL';
}

export interface ApplicationCommandData {
export interface BaseApplicationCommandData {
name: string;
description?: string;
type?: ApplicationCommandType | ApplicationCommandTypes;
options?: ApplicationCommandOptionData[];
defaultPermission?: boolean;
}

export interface UserApplicationCommandData extends BaseApplicationCommandData {
type: 'USER' | ApplicationCommandTypes.USER;
}

export interface MessageApplicationCommandData extends BaseApplicationCommandData {
type: 'MESSAGE' | ApplicationCommandTypes.MESSAGE;
}

export interface ChatInputApplicationCommandData extends BaseApplicationCommandData {
description: string;
type: 'CHAT_INPUT' | ApplicationCommandTypes.CHAT_INPUT;
options?: ApplicationCommandOptionData[];
}

export type ApplicationCommandData =
| UserApplicationCommandData
| MessageApplicationCommandData
| ChatInputApplicationCommandData;

export interface ApplicationCommandOptionData {
type: ApplicationCommandOptionType | ApplicationCommandOptionTypes;
name: string;
Expand Down

0 comments on commit 75b48d8

Please sign in to comment.