mirror of
https://github.com/discordjs/discord.js.git
synced 2026-09-17 08:47:27 +00: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:
co-authored by
almeidx
Jiralite
parent
74a42bfd10
commit
07c412791d
+1
-1
@@ -5426,7 +5426,7 @@ export class UserManager extends CachedManager<Snowflake, User, UserResolvable>
|
||||
public fetch(user: UserResolvable, options?: BaseFetchOptions): Promise<User>;
|
||||
/** @deprecated This method is deprecated and will be removed in the next major version. Flags may still be retrieved via {@link UserManager.fetch} */
|
||||
public fetchFlags(user: UserResolvable, options?: BaseFetchOptions): Promise<UserFlagsBitField>;
|
||||
public send(user: UserResolvable, options: string | MessagePayload | MessageCreateOptions): Promise<Message>;
|
||||
public send(user: UserResolvable, options: string | MessagePayload | MessageCreateOptions): Promise<Message<false>>;
|
||||
}
|
||||
|
||||
export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, typeof VoiceState> {
|
||||
|
||||
@@ -1517,6 +1517,8 @@ expectType<TextBasedChannelFields<true>['send']>(voiceChannel.send);
|
||||
expectAssignable<PartialTextBasedChannelFields>(user);
|
||||
expectAssignable<PartialTextBasedChannelFields>(guildMember);
|
||||
|
||||
expectType<Promise<Message<false>>>(client.users.send(user, 'test'));
|
||||
|
||||
expectType<Promise<NewsChannel>>(textChannel.setType(ChannelType.GuildAnnouncement));
|
||||
expectType<Promise<TextChannel>>(newsChannel.setType(ChannelType.GuildText));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user