67 lines
2.1 KiB
TypeScript
67 lines
2.1 KiB
TypeScript
/// <reference types="next" />
|
|
/// <reference types="next/image-types/global" />
|
|
|
|
// Web Speech API types
|
|
interface SpeechRecognitionErrorEvent extends Event {
|
|
error: string;
|
|
message: string;
|
|
}
|
|
|
|
interface SpeechRecognitionResultList {
|
|
length: number;
|
|
item(index: number): SpeechRecognitionResult;
|
|
[index: number]: SpeechRecognitionResult;
|
|
}
|
|
|
|
interface SpeechRecognitionResult {
|
|
length: number;
|
|
item(index: number): SpeechRecognitionAlternative;
|
|
[index: number]: SpeechRecognitionAlternative;
|
|
isFinal: boolean;
|
|
}
|
|
|
|
interface SpeechRecognitionAlternative {
|
|
transcript: string;
|
|
confidence: number;
|
|
}
|
|
|
|
interface SpeechRecognitionEvent extends Event {
|
|
resultIndex: number;
|
|
results: SpeechRecognitionResultList;
|
|
}
|
|
|
|
interface SpeechRecognitionInstance extends EventTarget {
|
|
lang: string;
|
|
continuous: boolean;
|
|
interimResults: boolean;
|
|
maxAlternatives: number;
|
|
onaudioend: ((this: SpeechRecognitionInstance, ev: Event) => void) | null;
|
|
onaudiostart: ((this: SpeechRecognitionInstance, ev: Event) => void) | null;
|
|
onend: ((this: SpeechRecognitionInstance, ev: Event) => void) | null;
|
|
onerror: ((this: SpeechRecognitionInstance, ev: SpeechRecognitionErrorEvent) => void) | null;
|
|
onnomatch: ((this: SpeechRecognitionInstance, ev: SpeechRecognitionEvent) => void) | null;
|
|
onresult: ((this: SpeechRecognitionInstance, ev: SpeechRecognitionEvent) => void) | null;
|
|
onsoundend: ((this: SpeechRecognitionInstance, ev: Event) => void) | null;
|
|
onsoundstart: ((this: SpeechRecognitionInstance, ev: Event) => void) | null;
|
|
onspeechend: ((this: SpeechRecognitionInstance, ev: Event) => void) | null;
|
|
onspeechstart: ((this: SpeechRecognitionInstance, ev: Event) => void) | null;
|
|
onstart: ((this: SpeechRecognitionInstance, ev: Event) => void) | null;
|
|
abort(): void;
|
|
start(): void;
|
|
stop(): void;
|
|
}
|
|
|
|
interface SpeechRecognitionConstructor {
|
|
new (): SpeechRecognitionInstance;
|
|
prototype: SpeechRecognitionInstance;
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
SpeechRecognition?: SpeechRecognitionConstructor;
|
|
webkitSpeechRecognition?: SpeechRecognitionConstructor;
|
|
}
|
|
}
|
|
|
|
export {};
|