fix: fix type error of useNoteCapture

This commit is contained in:
Lhc_fl 2024-10-21 01:38:03 +08:00
parent 54addd0390
commit 684be7d709
No known key found for this signature in database
GPG Key ID: 3A10435B21EDC6AA
1 changed files with 3 additions and 3 deletions

View File

@ -22,7 +22,7 @@ export function useNoteCapture(props: {
const pureNote = props.pureNote !== undefined ? props.pureNote : props.note; const pureNote = props.pureNote !== undefined ? props.pureNote : props.note;
const connection = $i ? useStream() : null; const connection = $i ? useStream() : null;
async function onStreamNoteUpdated(noteData): void { async function onStreamNoteUpdated(noteData): Promise<void> {
const { type, id, body } = noteData; const { type, id, body } = noteData;
if ((id !== note.value.id) && (id !== pureNote.value.id)) return; if ((id !== note.value.id) && (id !== pureNote.value.id)) return;
@ -81,7 +81,7 @@ export function useNoteCapture(props: {
case 'pollVoted': { case 'pollVoted': {
const choice = body.choice; const choice = body.choice;
const choices = [...note.value.poll.choices]; const choices = [...note.value.poll!.choices];
choices[choice] = { choices[choice] = {
...choices[choice], ...choices[choice],
votes: choices[choice].votes + 1, votes: choices[choice].votes + 1,
@ -90,7 +90,7 @@ export function useNoteCapture(props: {
} : {}), } : {}),
}; };
note.value.poll.choices = choices; note.value.poll!.choices = choices;
break; break;
} }