mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 21:13:30 +01:00
chore(builders): simplify types (#7784)
* chore(builders): simplify types * chore: removed uneeded partial
This commit is contained in:
20
packages/discord.js/typings/index.d.ts
vendored
20
packages/discord.js/typings/index.d.ts
vendored
@@ -28,6 +28,7 @@ import {
|
||||
userMention,
|
||||
ModalActionRowComponentBuilder,
|
||||
ModalBuilder as BuildersModal,
|
||||
AnyComponentBuilder,
|
||||
} from '@discordjs/builders';
|
||||
import { Collection } from '@discordjs/collection';
|
||||
import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions } from '@discordjs/rest';
|
||||
@@ -232,17 +233,12 @@ export interface ActionRowData<T extends ActionRowComponentBuilder | ActionRowCo
|
||||
components: T[];
|
||||
}
|
||||
|
||||
export class ActionRowBuilder<
|
||||
T extends MessageActionRowComponentBuilder | ModalActionRowComponentBuilder =
|
||||
| MessageActionRowComponentBuilder
|
||||
| ModalActionRowComponentBuilder,
|
||||
> extends BuilderActionRow<T> {
|
||||
export class ActionRowBuilder<T extends AnyComponentBuilder = AnyComponentBuilder> extends BuilderActionRow<T> {
|
||||
constructor(
|
||||
data?:
|
||||
data?: Partial<
|
||||
| ActionRowData<ActionRowComponentData | ActionRowComponentBuilder>
|
||||
| (Omit<APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>, 'type'> & {
|
||||
type?: ComponentType.ActionRow;
|
||||
}),
|
||||
| APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>
|
||||
>,
|
||||
);
|
||||
public static from(
|
||||
other:
|
||||
@@ -577,9 +573,7 @@ export class ButtonBuilder extends BuilderButtonComponent {
|
||||
}
|
||||
|
||||
export class SelectMenuBuilder extends BuilderSelectMenuComponent {
|
||||
public constructor(
|
||||
data?: SelectMenuComponentData | (Omit<APISelectMenuComponent, 'type'> & { type?: ComponentType.SelectMenu }),
|
||||
);
|
||||
public constructor(data?: Partial<SelectMenuComponentData | APISelectMenuComponent>);
|
||||
public static from(other: JSONEncodable<APISelectMenuComponent> | APISelectMenuComponent): SelectMenuBuilder;
|
||||
}
|
||||
|
||||
@@ -593,7 +587,7 @@ export class ModalBuilder extends BuildersModal {
|
||||
}
|
||||
|
||||
export class TextInputBuilder extends BuilderTextInputComponent {
|
||||
public constructor(data?: TextInputComponentData | APITextInputComponent);
|
||||
public constructor(data?: Partial<TextInputComponentData | APITextInputComponent>);
|
||||
public static from(other: JSONEncodable<APITextInputComponent> | APITextInputComponent): TextInputBuilder;
|
||||
}
|
||||
|
||||
|
||||
@@ -808,8 +808,8 @@ client.on('interactionCreate', async interaction => {
|
||||
// @ts-expect-error
|
||||
interaction.reply({ content: 'Hi!', components: [[button]] });
|
||||
|
||||
// @ts-expect-error
|
||||
void new ActionRowBuilder({});
|
||||
|
||||
// @ts-expect-error
|
||||
await interaction.reply({ content: 'Hi!', components: [button] });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user