@@ -60,3 +60,40 @@ export class WebSpeechSttClient extends BaseSttClient {
6060 this . restartGracePeriod ( ) ;
6161 }
6262}
63+
64+ //Fix. Add own interface declaration for SpeechRecognition
65+ declare global {
66+ interface Window {
67+ SpeechRecognition : typeof SpeechRecognition ;
68+ webkitSpeechRecognition : typeof SpeechRecognition ;
69+ }
70+
71+ // The browser’s Web Speech API type (simplified)
72+ var SpeechRecognition : {
73+ new ( ) : SpeechRecognition ;
74+ } ;
75+
76+ interface SpeechRecognition extends EventTarget {
77+ continuous : boolean ;
78+ interimResults : boolean ;
79+ lang : string ;
80+ start ( ) : void ;
81+ stop ( ) : void ;
82+ abort ( ) : void ;
83+ onaudioend ?: ( this : SpeechRecognition , ev : Event ) => any ;
84+ onaudiostart ?: ( this : SpeechRecognition , ev : Event ) => any ;
85+ onend ?: ( this : SpeechRecognition , ev : Event ) => any ;
86+ onerror ?: ( this : SpeechRecognition , ev : Event ) => any ;
87+ onnomatch ?: ( this : SpeechRecognition , ev : Event ) => any ;
88+ onresult ?: ( this : SpeechRecognition , ev : SpeechRecognitionEvent ) => any ;
89+ onsoundend ?: ( this : SpeechRecognition , ev : Event ) => any ;
90+ onsoundstart ?: ( this : SpeechRecognition , ev : Event ) => any ;
91+ onspeechend ?: ( this : SpeechRecognition , ev : Event ) => any ;
92+ onspeechstart ?: ( this : SpeechRecognition , ev : Event ) => any ;
93+ onstart ?: ( this : SpeechRecognition , ev : Event ) => any ;
94+ }
95+
96+ interface SpeechRecognitionEvent extends Event {
97+ results : SpeechRecognitionResultList ;
98+ }
99+ }
0 commit comments