Skip to content

Commit 850d08b

Browse files
committed
improve types
1 parent b40b95c commit 850d08b

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

src/plugins/data/server/search/session/session_service.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,13 @@ export class SearchSessionService implements ISearchSessionService {
207207

208208
return {
209209
...findResponse,
210-
statuses: sessionStatuses.reduce((res, status, index) => {
211-
res[findResponse.saved_objects[index].id] = { status };
212-
return res;
213-
}, {} as Record<string, SearchSessionStatusResponse>),
210+
statuses: sessionStatuses.reduce<Record<string, SearchSessionStatusResponse>>(
211+
(res, status, index) => {
212+
res[findResponse.saved_objects[index].id] = { status };
213+
return res;
214+
},
215+
{}
216+
),
214217
};
215218
};
216219

@@ -311,10 +314,13 @@ export class SearchSessionService implements ISearchSessionService {
311314
const queue = this.trackIdBatchQueueMap.get(sessionId)?.queue ?? [];
312315
if (queue.length === 0) return;
313316
this.trackIdBatchQueueMap.delete(sessionId);
314-
const batchedIdMapping = queue.reduce((res, next) => {
315-
res[next.requestHash] = next.searchInfo;
316-
return res;
317-
}, {} as SearchSessionSavedObjectAttributes['idMapping']);
317+
const batchedIdMapping = queue.reduce<SearchSessionSavedObjectAttributes['idMapping']>(
318+
(res, next) => {
319+
res[next.requestHash] = next.searchInfo;
320+
return res;
321+
},
322+
{}
323+
);
318324
this.update(queue[0].deps, queue[0].user, sessionId, { idMapping: batchedIdMapping })
319325
.then(() => {
320326
queue.forEach((q) => q.resolve());

0 commit comments

Comments
 (0)