add isPureRenotePacked
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user