Fix TypeScript compilation errors in BookSelector and ChapterSelector by explicitly typing Set<string>

This commit is contained in:
Ryderjj89
2025-09-13 18:25:29 -04:00
parent 07c975b1d0
commit f008fc64b4
2 changed files with 10 additions and 10 deletions

View File

@@ -30,11 +30,11 @@ const BookSelector: React.FC<BookSelectorProps> = ({ books, onBookSelect, format
if (response.ok) { if (response.ok) {
const data = await response.json(); const data = await response.json();
const bookFavorites = new Set( const favoriteBooks: string[] = data.favorites
data.favorites .filter((fav: any) => !fav.chapter) // Only book-level favorites
.filter((fav: any) => !fav.chapter) // Only book-level favorites .map((fav: any) => fav.book);
.map((fav: any) => fav.book)
); const bookFavorites = new Set<string>(favoriteBooks);
setFavorites(bookFavorites); setFavorites(bookFavorites);
} }
} catch (error) { } catch (error) {

View File

@@ -36,11 +36,11 @@ const ChapterSelector: React.FC<ChapterSelectorProps> = ({ book, onChapterSelect
if (response.ok) { if (response.ok) {
const data = await response.json(); const data = await response.json();
const chapterFavorites = new Set( const favoriteChapters: string[] = data.favorites
data.favorites .filter((fav: any) => fav.book === book && fav.chapter && !fav.verse_start) // Only chapter-level favorites for this book
.filter((fav: any) => fav.book === book && fav.chapter && !fav.verse_start) // Only chapter-level favorites for this book .map((fav: any) => fav.chapter);
.map((fav: any) => fav.chapter)
); const chapterFavorites = new Set<string>(favoriteChapters);
setFavorites(chapterFavorites); setFavorites(chapterFavorites);
} }
} catch (error) { } catch (error) {