mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 08:03:30 +01:00
types(UserManager): fix send() return type to Promise<Message<false>> (#11337)
* types(UserManager): fix send() return type to Promise<Message<false>> UserManager.send() always sends a direct message (DM), so the return type should b Promise<Message<false>> instead of Promise<Message> to correctly indicate that the message is not in a guild context. Closes #11331 * fix: requested changes --------- Co-authored-by: almeidx <github@almeidx.dev> Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
2
packages/discord.js/typings/index.d.ts
vendored
2
packages/discord.js/typings/index.d.ts
vendored
@@ -4801,7 +4801,7 @@ export class UserManager extends CachedManager<Snowflake, User, UserResolvable>
|
||||
public createDM(user: UserResolvable, options?: BaseFetchOptions): Promise<DMChannel>;
|
||||
public deleteDM(user: UserResolvable): Promise<DMChannel>;
|
||||
public fetch(user: UserResolvable, options?: BaseFetchOptions): Promise<User>;
|
||||
public send(user: UserResolvable, options: MessageCreateOptions | MessagePayload | string): Promise<Message>;
|
||||
public send(user: UserResolvable, options: MessageCreateOptions | MessagePayload | string): Promise<Message<false>>;
|
||||
}
|
||||
|
||||
export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, typeof VoiceState> {
|
||||
|
||||
@@ -1534,6 +1534,8 @@ expectType<SendMethod<true>['send']>(voiceChannel.send);
|
||||
expectAssignable<SendMethod>(user);
|
||||
expectAssignable<SendMethod>(guildMember);
|
||||
|
||||
expectType<Promise<Message<false>>>(client.users.send(user, 'test'));
|
||||
|
||||
expectType<Promise<AnnouncementChannel>>(textChannel.setType(ChannelType.GuildAnnouncement));
|
||||
expectType<Promise<TextChannel>>(announcementChannel.setType(ChannelType.GuildText));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user