type SpeechRecognitionErrorCode = 'aborted' | 'audio-capture' | 'bad-grammar' | 'language-not-supported' | 'network' | 'no-speech' | 'not-allowed' | 'service-not-allowed'; interface SpeechRecognitionErrorEventInit extends EventInit { error: SpeechRecognitionErrorCode; message?: string; } interface SpeechRecognitionEventInit extends EventInit { resultIndex?: number; results: SpeechRecognitionResultList; } interface SpeechGrammar { src: string; weight: number; } interface SpeechGrammarList { readonly length: number; addFromString: (string: string, weight?: number) => void; addFromURI: (src: string, weight?: number) => void; item: (index: number) => SpeechGrammar; [index: number]: SpeechGrammar; } interface SpeechRecognitionErrorEvent extends Event { readonly error: SpeechRecognitionErrorCode; readonly message: string; } interface SpeechRecognitionEvent extends Event { readonly resultIndex: number; readonly results: SpeechRecognitionResultList; } interface SpeechRecognitionEventMap { audioend: Event; audiostart: Event; end: Event; error: SpeechRecognitionErrorEvent; nomatch: SpeechRecognitionEvent; result: SpeechRecognitionEvent; soundend: Event; soundstart: Event; speechend: Event; speechstart: Event; start: Event; } interface SpeechRecognition extends EventTarget { continuous: boolean; grammars: SpeechGrammarList; interimResults: boolean; lang: string; maxAlternatives: number; onaudioend: ((this: SpeechRecognition, ev: Event) => any) | null; onaudiostart: ((this: SpeechRecognition, ev: Event) => any) | null; onend: ((this: SpeechRecognition, ev: Event) => any) | null; onerror: ((this: SpeechRecognition, ev: SpeechRecognitionErrorEvent) => any) | null; onnomatch: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null; onresult: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null; onsoundend: ((this: SpeechRecognition, ev: Event) => any) | null; onsoundstart: ((this: SpeechRecognition, ev: Event) => any) | null; onspeechend: ((this: SpeechRecognition, ev: Event) => any) | null; onspeechstart: ((this: SpeechRecognition, ev: Event) => any) | null; onstart: ((this: SpeechRecognition, ev: Event) => any) | null; abort: () => void; start: () => void; stop: () => void; addEventListener: ((type: K, listener: (this: SpeechRecognition, ev: SpeechRecognitionEventMap[K]) => any, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void); removeEventListener: ((type: K, listener: (this: SpeechRecognition, ev: SpeechRecognitionEventMap[K]) => any, options?: boolean | EventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void); } export { SpeechRecognition, SpeechRecognitionErrorCode, SpeechRecognitionErrorEvent, SpeechRecognitionErrorEventInit, SpeechRecognitionEventInit };