Kaynağa Gözat

improve isIPageInfoForEntity

Yuki Takei 1 yıl önce
ebeveyn
işleme
ebb3f0cdb5
1 değiştirilmiş dosya ile 4 ekleme ve 1 silme
  1. 4 1
      packages/core/src/interfaces/page.ts

+ 4 - 1
packages/core/src/interfaces/page.ts

@@ -102,7 +102,10 @@ export type IPageInfoAll = IPageInfo | IPageInfoForEntity | IPageInfoForOperatio
 
 // eslint-disable-next-line @typescript-eslint/no-explicit-any
 export const isIPageInfoForEntity = (pageInfo: any | undefined): pageInfo is IPageInfoForEntity => {
-  return pageInfo != null;
+  return pageInfo != null && pageInfo instanceof Object
+    && ('commentCount' in pageInfo)
+    && ('bookmarkCount' in pageInfo)
+    && ('descendantCount' in pageInfo);
 };
 
 // eslint-disable-next-line @typescript-eslint/no-explicit-any