Skip to content

Commit c0f7a1a

Browse files
types(Message): remove & this from #inGuild typeguard (#8704)
1 parent a7eab50 commit c0f7a1a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/discord.js/typings/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,7 @@ export class Message<InGuild extends boolean = boolean> extends Base {
17501750
public toJSON(): unknown;
17511751
public toString(): string;
17521752
public unpin(reason?: string): Promise<Message<InGuild>>;
1753-
public inGuild(): this is Message<true> & this;
1753+
public inGuild(): this is Message<true>;
17541754
}
17551755

17561756
export class AttachmentBuilder {

packages/discord.js/typings/index.test-d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,11 @@ declare const assertIsMessage: (m: Promise<Message>) => void;
309309

310310
client.on('messageCreate', async message => {
311311
const { client, channel } = message;
312+
313+
if (!message.inGuild() && message.partial) {
314+
expectNotType<never>(message);
315+
}
316+
312317
expectType<Client<true>>(client);
313318
assertIsMessage(channel.send('string'));
314319
assertIsMessage(channel.send({}));

0 commit comments

Comments
 (0)