From 8be58920ba9e057ccee57bd2a166727bd55301f3 Mon Sep 17 00:00:00 2001 From: Joe Howard Date: Sun, 26 Jan 2025 20:08:32 -0600 Subject: [PATCH] try casting type directly --- src/services/youtube-api.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/youtube-api.ts b/src/services/youtube-api.ts index 6d8c798..944d4d8 100644 --- a/src/services/youtube-api.ts +++ b/src/services/youtube-api.ts @@ -74,7 +74,7 @@ export default class { } async search(query: string, shouldSplitChapters: boolean): Promise { - const {items} = await this.ytsrQueue.add(async () => this.cache.wrap( + const {items}: ytsr.VideoResult | void = await this.ytsrQueue.add(async () => this.cache.wrap( ytsr, query, { @@ -85,6 +85,10 @@ export default class { }, )); + if (!items) { + return []; + } + let firstVideo: Video | undefined; for (const item of items) {