Fixes to Invite types/type guard functions
This commit is contained in:
parent
ed5df73ebc
commit
fa18c234d6
1 changed files with 5 additions and 5 deletions
|
@ -8,6 +8,7 @@ import {
|
||||||
GuildChannel,
|
GuildChannel,
|
||||||
GuildMember,
|
GuildMember,
|
||||||
Invite,
|
Invite,
|
||||||
|
InviteGuild,
|
||||||
LimitedCollection,
|
LimitedCollection,
|
||||||
Message,
|
Message,
|
||||||
MessageAttachment,
|
MessageAttachment,
|
||||||
|
@ -248,9 +249,8 @@ export function nonNullish<V>(v: V): v is NonNullable<V> {
|
||||||
return v != null;
|
return v != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type InviteOpts = "withMetadata" | "withCount" | "withoutCount";
|
export type GuildInvite = Invite & { guild: InviteGuild | Guild };
|
||||||
export type GuildInvite<CT extends InviteOpts = "withMetadata"> = Invite & { guild: Guild };
|
export type GroupDMInvite = Invite & {
|
||||||
export type GroupDMInvite<CT extends InviteOpts = "withMetadata"> = Invite & {
|
|
||||||
channel: PartialChannelData;
|
channel: PartialChannelData;
|
||||||
type: typeof Constants.ChannelTypes.GROUP_DM;
|
type: typeof Constants.ChannelTypes.GROUP_DM;
|
||||||
};
|
};
|
||||||
|
@ -1480,11 +1480,11 @@ export function isFullMessage(msg: Message | PartialMessage): msg is Message {
|
||||||
return (msg as Message).createdAt != null;
|
return (msg as Message).createdAt != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isGuildInvite<CT extends InviteOpts>(invite: Invite): invite is GuildInvite<CT> {
|
export function isGuildInvite(invite: Invite): invite is GuildInvite {
|
||||||
return invite.guild != null;
|
return invite.guild != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isGroupDMInvite<CT extends InviteOpts>(invite: Invite): invite is GroupDMInvite<CT> {
|
export function isGroupDMInvite(invite: Invite): invite is GroupDMInvite {
|
||||||
return invite.guild == null && invite.channel?.type === ChannelTypeStrings.GROUP;
|
return invite.guild == null && invite.channel?.type === ChannelTypeStrings.GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue