@@ -116,13 +116,13 @@ type ConversationActions = {
116116 end : ( ) => Promise < void > ;
117117} ;
118118
119- export type ConversationInstance = ( ConversationStateConnecting | ConversationStateConnected | ConversationStateDisconnected ) & ConversationActions ;
119+ export type UseConversationReturn = ( ConversationStateConnecting | ConversationStateConnected | ConversationStateDisconnected ) & ConversationActions ;
120120
121121/**
122122 * AgentSession represents a connection to a LiveKit Agent, providing abstractions to make 1:1
123123 * agent/participant rooms easier to work with.
124124 */
125- export function useConversationWith ( agentToDispatch : string | RoomAgentDispatch | null , options : ConversationOptions ) : ConversationInstance {
125+ export function useConversationWith ( agentToDispatch : string | RoomAgentDispatch | null , options : ConversationOptions ) : UseConversationReturn {
126126 const roomFromContext = useMaybeRoomContext ( ) ;
127127 const room = useMemo ( ( ) => roomFromContext ?? options . room ?? new Room ( ) , [ roomFromContext , options . room ] ) ;
128128
@@ -145,7 +145,7 @@ export function useConversationWith(agentToDispatch: string | RoomAgentDispatch
145145 } ;
146146 } , [ options . tokenSource ] ) ;
147147
148- const generateDerivedConnectionStateValues = useCallback ( < State extends ConversationInstance [ "connectionState" ] > ( connectionState : State ) => ( {
148+ const generateDerivedConnectionStateValues = useCallback ( < State extends UseConversationReturn [ "connectionState" ] > ( connectionState : State ) => ( {
149149 isConnected : (
150150 connectionState === ConnectionState . Connected ||
151151 connectionState === ConnectionState . Reconnecting ||
@@ -275,13 +275,13 @@ export function useConversationWith(agentToDispatch: string | RoomAgentDispatch
275275 emitter . emit ( ConversationEvent . ConnectionStateChanged , conversationState . connectionState ) ;
276276 } , [ emitter , conversationState . connectionState ] ) ;
277277
278- const waitUntilConnectionState = useCallback ( async ( state : ConversationInstance [ "connectionState" ] , signal ?: AbortSignal ) => {
278+ const waitUntilConnectionState = useCallback ( async ( state : UseConversationReturn [ "connectionState" ] , signal ?: AbortSignal ) => {
279279 if ( conversationState . connectionState === state ) {
280280 return ;
281281 }
282282
283283 return new Promise < void > ( ( resolve , reject ) => {
284- const onceEventOccurred = ( newState : ConversationInstance [ "connectionState" ] ) => {
284+ const onceEventOccurred = ( newState : UseConversationReturn [ "connectionState" ] ) => {
285285 if ( newState !== state ) {
286286 return ;
287287 }
@@ -393,6 +393,6 @@ export function useConversationWith(agentToDispatch: string | RoomAgentDispatch
393393 ] ) ;
394394}
395395
396- export function useConversation ( options : ConversationOptions ) : ConversationInstance {
396+ export function useConversation ( options : ConversationOptions ) : UseConversationReturn {
397397 return useConversationWith ( null , options ) ;
398398}
0 commit comments