Skip to content

Commit

Permalink
Fix TypeScript error with currentTitle check
Browse files Browse the repository at this point in the history
Fixes TypeScript error TS2345: Argument of type 'string | undefined'
is not assignable to parameter of type 'string'
  • Loading branch information
YouG-o committed Feb 15, 2025
1 parent a65d909 commit aca4a15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/content/titleTranslation/otherTitles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ const otherTitles = document.querySelectorAll('#video-title') as NodeListOf<HTML
if (!originalTitle) {
otherTitlesLog(`Failed to get original title from API: ${videoId}, keeping current title`);
titleElement.removeAttribute('ynt');
titleElement.setAttribute('title', currentTitle);
currentTitle && titleElement.setAttribute('title', currentTitle);
continue;
}
if (currentTitle === originalTitle) {
//otherTitlesLog('Title is not translated: ', videoId);
titleElement.removeAttribute('ynt');
titleElement.setAttribute('title', currentTitle);
currentTitle && titleElement.setAttribute('title', currentTitle);
continue;
}
//otherTitlesLog('Title is translated: ', videoId);
Expand Down

0 comments on commit aca4a15

Please sign in to comment.