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:
parent
097471863e
commit
8f730b8270
5 changed files with 14 additions and 8 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue