@@ -146,9 +146,15 @@ export const Editor: React.FC<EditorProps> = ({ pagePath, onClose }) => {
146146
147147 // Speech recognition functions
148148 const startListening = ( ) => {
149+ interface WindowWithSpeech extends Window {
150+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
151+ SpeechRecognition ?: { new ( ) : any } ;
152+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
153+ webkitSpeechRecognition ?: { new ( ) : any } ;
154+ }
149155 const SpeechRecognition =
150- ( window as any ) . SpeechRecognition ||
151- ( window as any ) . webkitSpeechRecognition ;
156+ ( window as unknown as WindowWithSpeech ) . SpeechRecognition ||
157+ ( window as unknown as WindowWithSpeech ) . webkitSpeechRecognition ;
152158 if ( ! SpeechRecognition ) {
153159 alert (
154160 "Speech recognition is not supported in this browser. Try Chrome or Edge." ,
@@ -163,10 +169,18 @@ export const Editor: React.FC<EditorProps> = ({ pagePath, onClose }) => {
163169
164170 let finalTranscript = "" ;
165171
166- recognition . onresult = ( event : any ) => {
167- for ( let i = event . resultIndex ; i < event . results . length ; i ++ ) {
168- const transcript = event . results [ i ] [ 0 ] . transcript ;
169- if ( event . results [ i ] . isFinal ) {
172+ recognition . onresult = ( event : unknown ) => {
173+ const typedEvent = event as {
174+ resultIndex : number ;
175+ results : { isFinal : boolean ; [ index : number ] : { transcript : string } } [ ] ;
176+ } ;
177+ for (
178+ let i = typedEvent . resultIndex ;
179+ i < typedEvent . results . length ;
180+ i ++
181+ ) {
182+ const transcript = typedEvent . results [ i ] [ 0 ] . transcript ;
183+ if ( typedEvent . results [ i ] . isFinal ) {
170184 finalTranscript += transcript + " " ;
171185 }
172186 }
@@ -197,9 +211,10 @@ export const Editor: React.FC<EditorProps> = ({ pagePath, onClose }) => {
197211 }
198212 } ;
199213
200- recognition . onerror = ( event : any ) => {
201- console . error ( "Speech recognition error:" , event . error ) ;
202- if ( event . error === "not-allowed" ) {
214+ recognition . onerror = ( event : unknown ) => {
215+ const typedEvent = event as { error ?: string } ;
216+ console . error ( "Speech recognition error:" , typedEvent . error ) ;
217+ if ( typedEvent . error === "not-allowed" ) {
203218 alert (
204219 "Microphone access denied. Please allow microphone access and try again." ,
205220 ) ;
@@ -240,7 +255,6 @@ export const Editor: React.FC<EditorProps> = ({ pagePath, onClose }) => {
240255 textarea . focus ( ) ;
241256
242257 // execCommand preserves native undo stack
243- // eslint-disable-next-line @typescript-eslint/no-deprecated
244258 const success = document . execCommand ( "insertText" , false , text ) ;
245259
246260 if ( ! success ) {
0 commit comments