From 60148c6a78d905719bdd864bee1869dc4bbb041d Mon Sep 17 00:00:00 2001 From: DTrombett <73136330+DTrombett@users.noreply.github.com> Date: Wed, 14 Jul 2021 17:14:20 +0200 Subject: [PATCH] types(Interaction): change inGuild return type (#6094) --- typings/index.d.ts | 2 +- typings/index.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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);