// TypeScript declarations for Web Speech API interface SpeechRecognition extends EventTarget { continuous: boolean grammars: SpeechGrammarList interimResults: boolean lang: string maxAlternatives: number serviceURI: string start(): void stop(): void abort(): void onaudiostart: ((this: SpeechRecognition, ev: Event) => any) | null onaudioend: ((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 onsoundstart: ((this: SpeechRecognition, ev: Event) => any) | null onsoundend: ((this: SpeechRecognition, ev: Event) => any) | null onspeechstart: ((this: SpeechRecognition, ev: Event) => any) | null onspeechend: ((this: SpeechRecognition, ev: Event) => any) | null onstart: ((this: SpeechRecognition, ev: Event) => any) | null } interface SpeechRecognitionEvent extends Event { readonly resultIndex: number readonly results: SpeechRecognitionResultList } interface SpeechRecognitionErrorEvent extends Event { readonly error: string readonly message: string } interface SpeechRecognitionResultList { readonly length: number item(index: number): SpeechRecognitionResult [index: number]: SpeechRecognitionResult } interface SpeechRecognitionResult { readonly isFinal: boolean readonly length: number item(index: number): SpeechRecognitionAlternative [index: number]: SpeechRecognitionAlternative } interface SpeechRecognitionAlternative { readonly transcript: string readonly confidence: number } interface SpeechGrammarList { readonly length: number item(index: number): SpeechGrammar [index: number]: SpeechGrammar addFromURI(src: string, weight?: number): void addFromString(string: string, weight?: number): void } interface SpeechGrammar { src: string weight: number } declare var SpeechRecognition: { prototype: SpeechRecognition new (): SpeechRecognition } declare var webkitSpeechRecognition: { prototype: SpeechRecognition new (): SpeechRecognition } interface Window { SpeechRecognition: typeof SpeechRecognition webkitSpeechRecognition: typeof webkitSpeechRecognition }