Skip to content

⬅️ Back to Table of Contents

📄 types.ts

📊 Analysis Summary

Metric Count
📐 Interfaces 8
📑 Type Aliases 1

📚 Table of Contents

🛠️ File Location:

📂 packages/core/useSpeechRecognition/types.ts

Interfaces

SpeechRecognitionErrorEventInit

Interface Code
export interface SpeechRecognitionErrorEventInit extends EventInit {
  error: SpeechRecognitionErrorCode
  message?: string
}

Properties

Name Type Optional Description
error SpeechRecognitionErrorCode
message string

SpeechRecognitionEventInit

Interface Code
export interface SpeechRecognitionEventInit extends EventInit {
  resultIndex?: number
  results: SpeechRecognitionResultList
}

Properties

Name Type Optional Description
resultIndex number
results SpeechRecognitionResultList

SpeechGrammar

Interface Code
interface SpeechGrammar {
  src: string
  weight: number
}

Properties

Name Type Optional Description
src string
weight number

SpeechGrammarList

Interface Code
interface SpeechGrammarList {
  readonly length: number
  addFromString: (string: string, weight?: number) => void
  addFromURI: (src: string, weight?: number) => void
  item: (index: number) => SpeechGrammar
  [index: number]: SpeechGrammar
}

Properties

Name Type Optional Description
length number
addFromString (string: string, weight?: number) => void
addFromURI (src: string, weight?: number) => void
item (index: number) => SpeechGrammar

SpeechRecognitionErrorEvent

Interface Code
export interface SpeechRecognitionErrorEvent extends Event {
  readonly error: SpeechRecognitionErrorCode
  readonly message: string
}

Properties

Name Type Optional Description
error SpeechRecognitionErrorCode
message string

SpeechRecognitionEvent

Interface Code
interface SpeechRecognitionEvent extends Event {
  readonly resultIndex: number
  readonly results: SpeechRecognitionResultList
}

Properties

Name Type Optional Description
resultIndex number
results SpeechRecognitionResultList

SpeechRecognitionEventMap

Interface Code
interface SpeechRecognitionEventMap {
  audioend: Event
  audiostart: Event
  end: Event
  error: SpeechRecognitionErrorEvent
  nomatch: SpeechRecognitionEvent
  result: SpeechRecognitionEvent
  soundend: Event
  soundstart: Event
  speechend: Event
  speechstart: Event
  start: Event
}

Properties

Name Type Optional Description
audioend Event
audiostart Event
end Event
error SpeechRecognitionErrorEvent
nomatch SpeechRecognitionEvent
result SpeechRecognitionEvent
soundend Event
soundstart Event
speechend Event
speechstart Event
start Event

SpeechRecognition

Interface Code
export 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: (<K extends keyof SpeechRecognitionEventMap>(type: K, listener: (this: SpeechRecognition, ev: SpeechRecognitionEventMap[K]) => any, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void)
  removeEventListener: (<K extends keyof SpeechRecognitionEventMap>(type: K, listener: (this: SpeechRecognition, ev: SpeechRecognitionEventMap[K]) => any, options?: boolean | EventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void)
}

Properties

Name Type Optional Description
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 (<K extends keyof SpeechRecognitionEventMap>(type: K, listener: (this: SpeechRecognition, ev: SpeechRecognitionEventMap[K]) => any, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void)
removeEventListener (<K extends keyof SpeechRecognitionEventMap>(type: K, listener: (this: SpeechRecognition, ev: SpeechRecognitionEventMap[K]) => any, options?: boolean | EventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void)

Type Aliases

SpeechRecognitionErrorCode

type SpeechRecognitionErrorCode = 'aborted' | 'audio-capture' | 'bad-grammar' | 'language-not-supported' | 'network' | 'no-speech' | 'not-allowed' | 'service-not-allowed';