mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
types: fix component *Data types (#7536)
This commit is contained in:
14
packages/discord.js/typings/index.d.ts
vendored
14
packages/discord.js/typings/index.d.ts
vendored
@@ -204,7 +204,11 @@ export interface ActionRowData extends BaseComponentData {
|
||||
}
|
||||
|
||||
export class ActionRow<T extends ActionRowComponent = ActionRowComponent> extends BuilderActionRow<T> {
|
||||
constructor(data?: ActionRowData | APIActionRowComponent<APIMessageComponent>);
|
||||
constructor(
|
||||
data?:
|
||||
| ActionRowData
|
||||
| (Omit<APIActionRowComponent<APIMessageComponent>, 'type'> & { type?: ComponentType.ActionRow }),
|
||||
);
|
||||
}
|
||||
|
||||
export class ActivityFlagsBitField extends BitField<ActivityFlagsString> {
|
||||
@@ -473,11 +477,13 @@ export class ButtonInteraction<Cached extends CacheType = CacheType> extends Mes
|
||||
}
|
||||
|
||||
export class ButtonComponent extends BuilderButtonComponent {
|
||||
public constructor(data?: ButtonComponentData | APIButtonComponent);
|
||||
public constructor(data?: ButtonComponentData | (Omit<APIButtonComponent, 'type'> & { type?: ComponentType.Button }));
|
||||
}
|
||||
|
||||
export class SelectMenuComponent extends BuilderSelectMenuComponent {
|
||||
public constructor(data?: SelectMenuComponentData | APISelectMenuComponent);
|
||||
public constructor(
|
||||
data?: SelectMenuComponentData | (Omit<APISelectMenuComponent, 'type'> & { type?: ComponentType.SelectMenu }),
|
||||
);
|
||||
}
|
||||
|
||||
export interface EmbedData {
|
||||
@@ -4619,7 +4625,7 @@ export interface MessageReference {
|
||||
export type MessageResolvable = Message | Snowflake;
|
||||
|
||||
export interface SelectMenuComponentData extends BaseComponentData {
|
||||
customId?: string;
|
||||
customId: string;
|
||||
disabled?: boolean;
|
||||
maxValues?: number;
|
||||
minValues?: number;
|
||||
|
||||
@@ -103,6 +103,7 @@ import {
|
||||
ShardEvents,
|
||||
Status,
|
||||
CategoryChannelChildManager,
|
||||
ActionRowData,
|
||||
} from '.';
|
||||
import { expectAssignable, expectDeprecated, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
||||
import { Embed } from '@discordjs/builders';
|
||||
@@ -1309,6 +1310,23 @@ new ActionRow({
|
||||
components: [selectMenu.toJSON(), button.toJSON()],
|
||||
});
|
||||
|
||||
new SelectMenuComponent({
|
||||
customId: 'foo',
|
||||
});
|
||||
|
||||
new ButtonComponent({
|
||||
style: ButtonStyle.Danger,
|
||||
});
|
||||
|
||||
expectNotAssignable<ActionRowData>({
|
||||
type: ComponentType.ActionRow,
|
||||
components: [
|
||||
{
|
||||
type: ComponentType.Button,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
declare const chatInputInteraction: ChatInputCommandInteraction;
|
||||
|
||||
expectType<MessageAttachment>(chatInputInteraction.options.getAttachment('attachment', true));
|
||||
|
||||
Reference in New Issue
Block a user