fix(types): resolve TypeScript linting errors for build

Fixed all TypeScript errors preventing build:
- Added TTSAudiobookChapter type import to HTMLContext
- Replaced 'any' types with proper TTSAudiobookChapter type
- Removed unused goToChapter from HTMLViewer destructuring
- Updated AudiobookExportModal to accept 'html' documentType
- Fixed HTMLContext return types to match EPUB/PDF contexts
  - createFullAudioBook now returns Promise<string> (bookId only)
  - regenerateChapter now returns Promise<TTSAudiobookChapter>
- Prefixed/removed unused parameters in placeholder functions

Build now completes successfully with only minor warnings
in placeholder code that will be implemented later.
This commit is contained in:
Claude 2026-01-11 04:47:44 +00:00
parent 757fa5811b
commit b13bf96b3b
No known key found for this signature in database
6 changed files with 22 additions and 15 deletions

View file

@ -132,7 +132,7 @@ async function processJobInBackground(jobId: string) {
job.currentStep = 'Loading document...'; job.currentStep = 'Loading document...';
jobs.set(jobId, job); jobs.set(jobId, job);
const { documentId, voice, speed, ttsProvider, ttsModel, ttsInstructions, format } = job.data; const { documentId, voice, speed, ttsProvider, ttsModel, format } = job.data;
// In a real implementation, this would: // In a real implementation, this would:
// 1. Load the document from IndexedDB or file system // 1. Load the document from IndexedDB or file system

View file

@ -20,7 +20,7 @@ import {
interface AudiobookExportModalProps { interface AudiobookExportModalProps {
isOpen: boolean; isOpen: boolean;
setIsOpen: (isOpen: boolean) => void; setIsOpen: (isOpen: boolean) => void;
documentType: 'epub' | 'pdf'; documentType: 'epub' | 'pdf' | 'html';
documentId: string; documentId: string;
onGenerateAudiobook: ( onGenerateAudiobook: (
onProgress: (progress: number) => void, onProgress: (progress: number) => void,

View file

@ -19,7 +19,6 @@ export function HTMLViewer({ className = '' }: HTMLViewerProps) {
totalChapters, totalChapters,
goToNextChapter, goToNextChapter,
goToPreviousChapter, goToPreviousChapter,
goToChapter,
} = useHTML(); } = useHTML();
const containerRef = useRef<HTMLDivElement>(null); const containerRef = useRef<HTMLDivElement>(null);

View file

@ -11,6 +11,7 @@ import {
import { getHtmlDocument } from '@/lib/dexie'; import { getHtmlDocument } from '@/lib/dexie';
import { useTTS } from '@/contexts/TTSContext'; import { useTTS } from '@/contexts/TTSContext';
import { detectChapters, type Chapter } from '@/lib/chapterDetection'; import { detectChapters, type Chapter } from '@/lib/chapterDetection';
import type { TTSAudiobookChapter } from '@/types/tts';
interface HTMLContextType { interface HTMLContextType {
currDocData: string | undefined; currDocData: string | undefined;
@ -31,16 +32,16 @@ interface HTMLContextType {
createFullAudioBook: ( createFullAudioBook: (
onProgress: (progress: number) => void, onProgress: (progress: number) => void,
signal: AbortSignal, signal: AbortSignal,
onChapterComplete: (chapter: any) => void, onChapterComplete: (chapter: TTSAudiobookChapter) => void,
documentId: string, documentId: string,
format: 'mp3' | 'm4b' format: 'mp3' | 'm4b'
) => Promise<{ bookId: string; format: string }>; ) => Promise<string>;
regenerateChapter: ( regenerateChapter: (
chapterIndex: number, chapterIndex: number,
bookId: string, bookId: string,
format: 'mp3' | 'm4b', format: 'mp3' | 'm4b',
signal: AbortSignal signal: AbortSignal
) => Promise<void>; ) => Promise<TTSAudiobookChapter>;
} }
const HTMLContext = createContext<HTMLContextType | undefined>(undefined); const HTMLContext = createContext<HTMLContextType | undefined>(undefined);
@ -123,10 +124,10 @@ export function HTMLProvider({ children }: { children: ReactNode }) {
*/ */
const createFullAudioBook = useCallback(async ( const createFullAudioBook = useCallback(async (
onProgress: (progress: number) => void, onProgress: (progress: number) => void,
signal: AbortSignal, _signal: AbortSignal,
onChapterComplete: (chapter: any) => void, _onChapterComplete: (chapter: TTSAudiobookChapter) => void,
documentId: string, documentId: string,
format: 'mp3' | 'm4b' _format: 'mp3' | 'm4b'
) => { ) => {
// Placeholder - will be implemented with job queue system // Placeholder - will be implemented with job queue system
console.log('createFullAudioBook called for HTML document:', documentId); console.log('createFullAudioBook called for HTML document:', documentId);
@ -134,7 +135,7 @@ export function HTMLProvider({ children }: { children: ReactNode }) {
// TODO: Integrate with background job queue // TODO: Integrate with background job queue
// For now, return a placeholder // For now, return a placeholder
return { bookId: 'placeholder', format }; return 'placeholder';
}, []); }, []);
/** /**
@ -145,10 +146,17 @@ export function HTMLProvider({ children }: { children: ReactNode }) {
chapterIndex: number, chapterIndex: number,
bookId: string, bookId: string,
format: 'mp3' | 'm4b', format: 'mp3' | 'm4b',
signal: AbortSignal _signal: AbortSignal
) => { ): Promise<TTSAudiobookChapter> => {
// Placeholder // Placeholder
console.log('regenerateChapter called:', chapterIndex, bookId, format); console.log('regenerateChapter called:', chapterIndex, bookId, format);
return {
index: chapterIndex,
title: `Chapter ${chapterIndex + 1}`,
status: 'completed',
bookId,
format,
};
}, []); }, []);
/** /**

View file

@ -99,7 +99,7 @@ function splitBySize(text: string, maxChunkSize: number): Chapter[] {
let currentChunk = ''; let currentChunk = '';
let chunkIndex = 0; let chunkIndex = 0;
paragraphs.forEach((paragraph, index) => { paragraphs.forEach((paragraph) => {
const potentialChunk = currentChunk + (currentChunk ? '\n\n' : '') + paragraph; const potentialChunk = currentChunk + (currentChunk ? '\n\n' : '') + paragraph;
if (potentialChunk.length > maxChunkSize && currentChunk.length > 0) { if (potentialChunk.length > maxChunkSize && currentChunk.length > 0) {

View file

@ -100,7 +100,7 @@ export async function processAudiobookJob(
* Fetch document content from storage * Fetch document content from storage
* This would integrate with your document storage system * This would integrate with your document storage system
*/ */
async function fetchDocumentContent(documentId: string, signal: AbortSignal): Promise<string> { async function fetchDocumentContent(_documentId: string, _signal: AbortSignal): Promise<string> {
// In a real implementation, this would: // In a real implementation, this would:
// 1. Query the document from IndexedDB or file system // 1. Query the document from IndexedDB or file system
// 2. Extract text content based on document type (PDF, EPUB, HTML) // 2. Extract text content based on document type (PDF, EPUB, HTML)
@ -115,7 +115,7 @@ async function fetchDocumentContent(documentId: string, signal: AbortSignal): Pr
* Process text into sentences * Process text into sentences
* Uses the existing NLP sentence splitting logic * Uses the existing NLP sentence splitting logic
*/ */
async function processTextToSentences(text: string, signal: AbortSignal): Promise<string[]> { async function processTextToSentences(text: string, _signal: AbortSignal): Promise<string[]> {
// This would use the same logic as the TTS context // This would use the same logic as the TTS context
// For now, simple split on sentence boundaries // For now, simple split on sentence boundaries
const sentences = text const sentences = text