Skip to content

Commit

Permalink
types(Interaction): change inGuild return type (#6094)
Browse files Browse the repository at this point in the history
  • Loading branch information
DTrombett committed Jul 14, 2021
1 parent a9e7ebd commit 60148c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions typings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
GuildMember,
GuildResolvable,
Intents,
Interaction,
Message,
MessageActionRow,
MessageAttachment,
Expand Down Expand Up @@ -604,3 +605,7 @@ client.on('messageReactionAdd', async reaction => {
if (reaction.message.partial) return assertType<string | null>(reaction.message.content);
assertType<string>(reaction.message.content);
});

// Test interactions
declare const interaction: Interaction;
if (interaction.inGuild()) assertType<Snowflake>(interaction.guildId);

0 comments on commit 60148c6

Please sign in to comment.