initial commit

This commit is contained in:
Kar k1
2025-08-30 18:18:57 +05:30
commit 7219108342
270 changed files with 70221 additions and 0 deletions

22
types/react-speech-recognition.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
declare module 'react-speech-recognition' {
export interface SpeechRecognitionOptions {
continuous?: boolean
language?: string
}
export interface UseSpeechRecognitionReturn {
transcript: string
listening: boolean
resetTranscript: () => void
browserSupportsSpeechRecognition: boolean
isMicrophoneAvailable: boolean
}
export function useSpeechRecognition(): UseSpeechRecognitionReturn
export default class SpeechRecognition {
static startListening(options?: SpeechRecognitionOptions): void
static stopListening(): void
static abortListening(): void
}
}

81
types/speech-recognition.d.ts vendored Normal file
View File

@@ -0,0 +1,81 @@
// 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
}