From 794b8cb63f09e6b58ac83af98c7b676e6c0e0dd7 Mon Sep 17 00:00:00 2001 From: xpa Date: Thu, 16 Jun 2022 21:15:53 +0900 Subject: [PATCH] fix type guard --- src/main.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index b53adc01..d4aa625d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -232,9 +232,9 @@ class NiconiComments { const parseDataStart = performance.now(); let data_: formattedComment[] = []; for (let i = 0; i < data.length; i++) { - for (let key in data[i]) { - let val = data[i]; - if (!val) continue; + let val = data[i]; + if (!val) continue; + for (let key in val) { let value = val[key]; if (isApiChat(value) && value["deleted"] !== 1) { let tmpParam: any = { @@ -1139,7 +1139,7 @@ const replaceAll = (string: string, target: string, replace: string) => { return string; } const isApiChat = (item: any): item is apiChat => - !!item.chat + item.id&&item.vpos&&item.vpos const logger = (msg: any) => { if (isDebug) console.debug(msg);