diff --git a/packages/api/src/textToSpeech.d.ts b/packages/api/src/textToSpeech.d.ts index 45e43969d..979a5a764 100644 --- a/packages/api/src/textToSpeech.d.ts +++ b/packages/api/src/textToSpeech.d.ts @@ -12,7 +12,7 @@ declare module '@omnivore/text-to-speech-handler' { } interface Utterance { - idx: number + idx: string wordOffset: number wordCount: number voice?: string diff --git a/packages/text-to-speech/src/htmlToSsml.ts b/packages/text-to-speech/src/htmlToSsml.ts index 5988453e6..9d2894821 100644 --- a/packages/text-to-speech/src/htmlToSsml.ts +++ b/packages/text-to-speech/src/htmlToSsml.ts @@ -7,7 +7,7 @@ import { htmlToText } from 'html-to-text' // frontend code in: useReadingProgressAnchor export interface Utterance { - idx: number + idx: string text: string wordOffset: number wordCount: number @@ -248,7 +248,7 @@ export const htmlToSsmlItems = ( const htmlToUtterance = ( tokenizer: WordPunctTokenizer, - idx: number, + idx: string, htmlItems: string[], wordOffset: number, voice?: string @@ -289,7 +289,7 @@ export const htmlToSpeechFile = ( const node = parsedNodes[i - 2] if (TOP_LEVEL_TAGS.includes(node.nodeName) || hasSignificantText(node)) { - const idx = i + const idx = i.toString() i = emitElement(textItems, node, true) const utterance = htmlToUtterance( tokenizer,