-
Notifications
You must be signed in to change notification settings - Fork 18
/
global.d.ts
58 lines (49 loc) · 1.55 KB
/
global.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// types/global.d.ts or global.d.ts in the root
interface Window {
SpeechRecognition: typeof SpeechRecognition;
webkitSpeechRecognition: typeof SpeechRecognition;
}
interface SpeechRecognition extends EventTarget {
new (): SpeechRecognition;
start(): void;
stop(): void;
abort(): void;
grammars: SpeechGrammarList;
lang: string;
continuous: boolean;
interimResults: boolean;
maxAlternatives: number;
onaudiostart: ((event: Event) => void) | null;
onaudioend: ((event: Event) => void) | null;
onend: ((event: Event) => void) | null;
onerror: ((event: Event) => void) | null;
onnomatch: ((event: Event) => void) | null;
onresult: ((event: SpeechRecognitionEvent) => void) | null;
onstart: ((event: Event) => void) | null;
}
interface SpeechRecognitionEvent extends Event {
results: SpeechRecognitionResultList;
}
interface SpeechRecognitionResultList {
length: number;
item(index: number): SpeechRecognitionResult;
[index: number]: SpeechRecognitionResult;
}
interface SpeechRecognitionResult {
isFinal: boolean;
length: number;
item(index: number): SpeechRecognitionAlternative;
[index: number]: SpeechRecognitionAlternative;
}
interface SpeechRecognitionAlternative {
confidence: number;
transcript: string;
}
interface SpeechGrammarList {
length: number;
item(index: number): SpeechGrammar;
[index: number]: SpeechGrammar;
}
interface SpeechGrammar {
// Define properties of SpeechGrammar if needed
}