Skip to content

Commit 918200e

Browse files
committed
fix(useSpeechRecognition.ts): fix jsdoc to correctly display on the ui
1 parent 905d323 commit 918200e

File tree

1 file changed

+6
-29
lines changed

1 file changed

+6
-29
lines changed

src/hooks/useSpeechRecognition/useSpeechRecognition.ts

+6-29
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,35 @@ interface SpeechRecognitionCallbacks {
66
onEnd?: () => void;
77
/** Callback invoked when an error occurs during recognition. */
88
onError?: (error: SpeechRecognitionErrorEvent) => void;
9-
/**
10-
* Callback invoked when recognition produces a result.
11-
*
12-
* When `options.interimResults` is true, this callback is called with interim results as the user speaks.
13-
* When `options.maxAlternatives` is greater than 1, the third parameter contains an array of all alternative transcripts.
14-
*
15-
* @param transcript - The transcript text (final or interim, depending on the result).
16-
* @param isFinal - Indicates whether the transcript is final.
17-
* @param alternatives - (Optional) An array of alternative transcripts (if more than one alternative is requested).
18-
*/
9+
/** Callback invoked when recognition produces a result. When `options.interimResults` is true, this callback is called with interim results as the user speaks. When `options.maxAlternatives` is greater than 1, the third parameter contains an array of all alternative transcripts. */
1910
onResult?: (transcript: string, isFinal: boolean, alternatives?: string[]) => void;
2011
/** Callback invoked when speech recognition begins capturing audio. */
2112
onStart?: () => void;
2213
}
2314

24-
/**
25-
* Parameters for configuring the useSpeechRecognition hook.
26-
*/
15+
/** Parameters for configuring the useSpeechRecognition hook. */
2716
interface UseSpeechRecognitionOptions extends SpeechRecognitionCallbacks {
2817
/** If true, recognition continues even after pauses in speech. Default is false. */
2918
continuous?: SpeechRecognition['continuous'];
3019
/** A list of grammar rules. Default is an empty SpeechGrammarList (if available). */
3120
grammars?: SpeechRecognition['grammars'];
3221
/** If true, interim (non-final) results are provided as the user speaks. Default is false. */
3322
interimResults?: SpeechRecognition['interimResults'];
34-
/**
35-
* The language in which recognition should occur.
36-
*
37-
* Must be a valid BCP 47 language tag (e.g., "en-US", "ru-RU"). Default is "en-US".
38-
*/
23+
/** The language in which recognition should occur. Must be a valid BCP 47 language tag (e.g., "en-US", "ru-RU"). Default is "en-US". */
3924
language?: SpeechRecognition['lang'];
40-
/**
41-
* The maximum number of alternative transcripts returned for a given recognition result.
42-
*
43-
* Must be a positive integer. Default is 1.
44-
*/
25+
/** The maximum number of alternative transcripts returned for a given recognition result. Must be a positive integer. Default is 1. */
4526
maxAlternatives?: SpeechRecognition['maxAlternatives'];
4627
}
4728

48-
/**
49-
* Represents the transcript state maintained by the hook.
50-
*/
29+
/** Represents the transcript state maintained by the hook. */
5130
interface Transcript {
5231
/** The latest interim transcript (if `interimResults` is true). */
5332
interimTranscript: string;
5433
/** The aggregated final transcript. */
5534
transcript: string;
5635
}
5736

58-
/**
59-
* The return type of the useSpeechRecognition hook.
60-
*/
37+
/** The return type of the useSpeechRecognition hook. */
6138
interface UseSpeechRecognitionReturn extends Transcript {
6239
/** The last error event encountered, or null if there is no error. */
6340
error: SpeechRecognitionErrorEvent | null;

0 commit comments

Comments
 (0)