Fix TypeScript compilation error in BibleReader by explicitly typing Set<string>

This commit is contained in:
Ryderjj89
2025-09-13 18:22:23 -04:00
parent aca8f9bd64
commit 07c975b1d0

View File

@@ -43,11 +43,11 @@ const BibleReader: React.FC<BibleReaderProps> = ({ book, chapter, onBack, format
if (response.ok) { if (response.ok) {
const data = await response.json(); const data = await response.json();
const verseFavorites = new Set( const favoriteStrings: string[] = data.favorites
data.favorites .filter((fav: any) => fav.book === book && fav.chapter === chapter && fav.verse_start) // Only verse-level favorites for this chapter
.filter((fav: any) => fav.book === book && fav.chapter === chapter && fav.verse_start) // Only verse-level favorites for this chapter .map((fav: any) => fav.verse_end ? `${fav.verse_start}-${fav.verse_end}` : fav.verse_start.toString());
.map((fav: any) => fav.verse_end ? `${fav.verse_start}-${fav.verse_end}` : fav.verse_start.toString())
); const verseFavorites = new Set<string>(favoriteStrings);
setFavorites(verseFavorites); setFavorites(verseFavorites);
} }
} catch (error) { } catch (error) {
@@ -124,7 +124,7 @@ const BibleReader: React.FC<BibleReaderProps> = ({ book, chapter, onBack, format
}; };
const getCurrentChapterIndex = () => { const getCurrentChapterIndex = () => {
return chapters.findIndex(ch => ch === chapter); return chapters.findIndex((ch: string) => ch === chapter);
}; };
const getPreviousChapter = () => { const getPreviousChapter = () => {