diff --git a/typings/index.d.ts b/typings/index.d.ts index d22f6325b..f1e26d067 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -831,7 +831,7 @@ export class Interaction extends Base { public type: InteractionType; public user: User; public version: number; - public inGuild(): boolean; + public inGuild(): this is this & { guildId: Snowflake; member: GuildMember | APIInteractionGuildMember }; public isButton(): this is ButtonInteraction; public isCommand(): this is CommandInteraction; public isMessageComponent(): this is MessageComponentInteraction; diff --git a/typings/index.ts b/typings/index.ts index e5461e76e..2f735626f 100644 --- a/typings/index.ts +++ b/typings/index.ts @@ -15,6 +15,7 @@ import { GuildMember, GuildResolvable, Intents, + Interaction, Message, MessageActionRow, MessageAttachment, @@ -604,3 +605,7 @@ client.on('messageReactionAdd', async reaction => { if (reaction.message.partial) return assertType(reaction.message.content); assertType(reaction.message.content); }); + +// Test interactions +declare const interaction: Interaction; +if (interaction.inGuild()) assertType(interaction.guildId);