mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
types(MessageOptions): fix components being optional (#6005)
This commit is contained in:
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -3728,7 +3728,7 @@ declare module 'discord.js' {
|
||||
type MessageActionRowComponentResolvable = MessageActionRowComponent | MessageActionRowComponentOptions;
|
||||
|
||||
interface MessageActionRowOptions extends BaseMessageComponentOptions {
|
||||
components?: MessageActionRowComponentResolvable[];
|
||||
components: MessageActionRowComponentResolvable[];
|
||||
}
|
||||
|
||||
interface MessageActivity {
|
||||
|
||||
@@ -5,7 +5,9 @@ import {
|
||||
Collection,
|
||||
Intents,
|
||||
Message,
|
||||
MessageActionRow,
|
||||
MessageAttachment,
|
||||
MessageButton,
|
||||
MessageEmbed,
|
||||
Permissions,
|
||||
Serialized,
|
||||
@@ -380,6 +382,26 @@ client.on('message', ({ channel }) => {
|
||||
channel.send({ another: 'property' });
|
||||
});
|
||||
|
||||
client.on('interaction', async interaction => {
|
||||
if (!interaction.isCommand()) return;
|
||||
|
||||
void new MessageActionRow();
|
||||
|
||||
const button = new MessageButton();
|
||||
|
||||
const actionRow = new MessageActionRow({ components: [button] });
|
||||
|
||||
await interaction.reply({ content: 'Hi!', components: [actionRow] });
|
||||
|
||||
await interaction.reply({ content: 'Hi!', components: [[button]] });
|
||||
|
||||
// @ts-expect-error
|
||||
void new MessageActionRow({});
|
||||
|
||||
// @ts-expect-error
|
||||
await interaction.reply({ content: 'Hi!', components: [button] });
|
||||
});
|
||||
|
||||
client.login('absolutely-valid-token');
|
||||
|
||||
// Test type transformation:
|
||||
|
||||
Reference in New Issue
Block a user