Narrow type of isPureRenote

This commit is contained in:
Michcio 2022-09-25 15:33:29 +02:00
parent 811d5cd0d7
commit 655f7a8dfc

View file

@ -1,5 +1,5 @@
import { Note } from '@/models/entities/note.js'; import { Note } from '@/models/entities/note.js';
export function isPureRenote(note: Note): boolean { export function isPureRenote(note: Note): note is Note & { renoteId: string, text: null, fileIds: null | never[], hasPoll: false } {
return note.renoteId != null && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !note.hasPoll; return note.renoteId != null && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !note.hasPoll;
} }