add isPureRenotePacked

This commit is contained in:
Hazelnoot 2024-11-08 09:55:26 -05:00
parent 41536480ce
commit 2fb2e52312

View file

@ -69,6 +69,14 @@ type PackedQuote =
fileIds: NonNullable<Packed<'Note'>['fileIds']> fileIds: NonNullable<Packed<'Note'>['fileIds']>
}); });
type PurePackedRenote = PackedRenote & {
text: NonNullable<Packed<'Note'>['text']>;
cw: NonNullable<Packed<'Note'>['cw']>;
replyId: NonNullable<Packed<'Note'>['replyId']>;
poll: NonNullable<Packed<'Note'>['poll']>;
fileIds: NonNullable<Packed<'Note'>['fileIds']>;
}
export function isRenotePacked(note: Packed<'Note'>): note is PackedRenote { export function isRenotePacked(note: Packed<'Note'>): note is PackedRenote {
return note.renoteId != null; return note.renoteId != null;
} }
@ -80,3 +88,7 @@ export function isQuotePacked(note: PackedRenote): note is PackedQuote {
note.poll != null || note.poll != null ||
(note.fileIds != null && note.fileIds.length > 0); (note.fileIds != null && note.fileIds.length > 0);
} }
export function isPureRenotePacked(note: Packed<'Note'>): note is PurePackedRenote {
return isRenotePacked(note) && !isQuotePacked(note);
}