1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix eslint warnings in ts files

This commit is contained in:
Bill Thornton 2023-04-26 11:30:57 -04:00
parent 097471863e
commit 8f730b8270
5 changed files with 14 additions and 8 deletions

View file

@ -31,25 +31,26 @@ function getItemsSplit(apiClient: ApiClient, userId: string, options: GetItemsRe
function mergeResults(results: BaseItemDtoQueryResult[]) {
const merged: BaseItemDtoQueryResult = {
Items: [],
TotalRecordCount: 0,
StartIndex: 0
};
// set TotalRecordCount separately so TS knows it is defined
merged.TotalRecordCount = 0;
for (const result of results) {
if (result.Items == null) {
if (!result.Items) {
console.log('[getItems] Retrieved Items array is invalid', result.Items);
continue;
}
if (result.TotalRecordCount == null) {
if (!result.TotalRecordCount) {
console.log('[getItems] Retrieved TotalRecordCount is invalid', result.TotalRecordCount);
continue;
}
if (result.StartIndex == null) {
if (typeof result.StartIndex === 'undefined') {
console.log('[getItems] Retrieved StartIndex is invalid', result.StartIndex);
continue;
}
merged.Items = merged.Items?.concat(result.Items);
merged.TotalRecordCount! += result.TotalRecordCount;
merged.TotalRecordCount += result.TotalRecordCount;
merged.StartIndex = Math.min(merged.StartIndex || 0, result.StartIndex);
}
return merged;