mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
types(AutocompleteOption): fix and improve types (#8069)
This commit is contained in:
@@ -258,17 +258,17 @@ class CommandInteractionOptionResolver {
|
||||
|
||||
/**
|
||||
* The full autocomplete option object.
|
||||
* @typedef {Object} AutocompleteOption
|
||||
* @typedef {Object} AutocompleteFocusedOption
|
||||
* @property {string} name The name of the option
|
||||
* @property {ApplicationCommandOptionType} type The type of the application command option
|
||||
* @property {string|number} value The value of the option
|
||||
* @property {string} value The value of the option
|
||||
* @property {boolean} focused Whether this option is currently in focus for autocomplete
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the focused option.
|
||||
* @param {boolean} [getFull=false] Whether to get the full option object
|
||||
* @returns {string|number|AutocompleteOption}
|
||||
* @returns {string|AutocompleteFocusedOption}
|
||||
* The value of the option, or the whole option if getFull is true
|
||||
*/
|
||||
getFocused(getFull = false) {
|
||||
|
||||
13
packages/discord.js/typings/index.d.ts
vendored
13
packages/discord.js/typings/index.d.ts
vendored
@@ -1007,8 +1007,8 @@ export class CommandInteractionOptionResolver<Cached extends CacheType = CacheTy
|
||||
): NonNullable<CommandInteractionOption<Cached>['member' | 'role' | 'user']> | null;
|
||||
public getMessage(name: string, required: true): NonNullable<CommandInteractionOption<Cached>['message']>;
|
||||
public getMessage(name: string, required?: boolean): NonNullable<CommandInteractionOption<Cached>['message']> | null;
|
||||
public getFocused(getFull: true): AutocompleteOption;
|
||||
public getFocused(getFull?: boolean): string | number;
|
||||
public getFocused(getFull: true): AutocompleteFocusedOption;
|
||||
public getFocused(getFull?: boolean): string;
|
||||
}
|
||||
|
||||
export class ContextMenuCommandInteraction<Cached extends CacheType = CacheType> extends CommandInteraction<Cached> {
|
||||
@@ -4064,7 +4064,14 @@ export interface CommandInteractionResolvedData<Cached extends CacheType = Cache
|
||||
attachments?: Collection<Snowflake, Attachment>;
|
||||
}
|
||||
|
||||
export type AutocompleteOption = Pick<CommandInteractionOption, 'name' | 'type' | 'value' | 'focused'>;
|
||||
export type AutocompleteFocusedOption = Pick<CommandInteractionOption, 'name'> & {
|
||||
focused: true;
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
| ApplicationCommandOptionType.Integer
|
||||
| ApplicationCommandOptionType.Number;
|
||||
value: string;
|
||||
};
|
||||
|
||||
export declare const Colors: {
|
||||
Default: 0x000000;
|
||||
|
||||
Reference in New Issue
Block a user