Skip to content

Instantly share code, notes, and snippets.

@rpf5573
Created June 2, 2019 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rpf5573/ac7c5e8e68fa556d729ed0897a30d6c7 to your computer and use it in GitHub Desktop.
Save rpf5573/ac7c5e8e68fa556d729ed0897a30d6c7 to your computer and use it in GitHub Desktop.
react-native-voice type definition file
declare module "react-native-voice" {
type Locale = 'en-US' | 'ko-KR' | 'ja-JP' | 'zh-CN' | 'zh_HK' | 'zh'
type Option = {
EXTRA_LANGUAGE_MODEL: string,
EXTRA_MAX_RESULTS: number,
EXTRA_PARTIAL_RESULTS: boolean,
REQUEST_PERMISSIONS_AUTO: boolean
}
type StartEvent = {
error: boolean
}
type RecognizedEvent = {
error: boolean
}
type EndEvent = {
error: boolean
}
type ErrorEvent = {
error: string
}
type Results = {
value: [string]
}
type PartialResults = {
value: [string]
}
function removeAllListeners(): void
function destroy(): Promise<{}>
function start(local: Locale, options?: Option): Promise<{}>
function stop(): Promise<{}>
function cancel(): Promise<{}>
function isAvailable(): Promise<{}>
function isRecognizing(): Promise<{}>
function onSpeechStart(e: StartEvent): void
function onSpeechRecognized(e: RecognizedEvent): void
function onSpeechEnd(e: EndEvent): void
function onSpeechError(e: ErrorEvent): void
function onSpeechResults(e: Results): void
function onSpeechPartialResults(e: PartialResults): void
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment