Skip to content

Commit c200460

Browse files
authored
fix type definition for the connect function (#307)
1 parent a74eaed commit c200460

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

packages/embed-react/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@humeai/voice-embed-react",
3-
"version": "0.1.21",
3+
"version": "0.1.22",
44
"description": "",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",

packages/embed/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@humeai/voice-embed",
3-
"version": "0.1.21",
3+
"version": "0.1.22",
44
"description": "",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",

packages/react/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@humeai/voice-react",
3-
"version": "0.1.21",
3+
"version": "0.1.22",
44
"description": "",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",

packages/react/src/lib/VoiceProvider.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
useVoiceClient,
2626
VoiceReadyState,
2727
} from './useVoiceClient';
28-
import { ConnectConfig } from '../models/connect-options';
28+
import { ConnectOptions } from '../models/connect-options';
2929
import {
3030
AssistantTranscriptMessage,
3131
AudioOutputMessage,
@@ -51,7 +51,7 @@ type VoiceStatus =
5151
};
5252

5353
export type VoiceContextType = {
54-
connect: () => Promise<void>;
54+
connect: (options?: ConnectOptions) => Promise<void>;
5555
disconnect: () => void;
5656
fft: number[];
5757
isMuted: boolean;
@@ -320,10 +320,10 @@ export const VoiceProvider: FC<VoiceProviderProps> = ({
320320
}, [sendResumeAssistantMessage, updateError]);
321321

322322
const connect = useCallback(
323-
async (connectConfig: ConnectConfig = {}) => {
323+
async (options: ConnectOptions = {}) => {
324324
updateError(null);
325325
setStatus({ value: 'connecting' });
326-
const permission = await getStream(connectConfig.audioConstraints);
326+
const permission = await getStream(options.audioConstraints);
327327

328328
if (permission === 'denied') {
329329
const message = 'Microphone permission denied';

packages/react/src/models/connect-options.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ export type AudioConstraints = {
44
autoGainControl?: boolean;
55
};
66

7-
export type ConnectConfig = {
7+
export type ConnectOptions = {
88
audioConstraints?: AudioConstraints;
99
};

0 commit comments

Comments
 (0)