File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed
components/AITypingIndicatorView/hooks Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -28,13 +28,16 @@ export const useAIState = <
2828 const [ aiState , setAiState ] = useState < AIStatesEnum > ( AIStatesEnum . Idle ) ;
2929
3030 useEffect ( ( ) => {
31- const indicatorChangedListener = channel . on ( 'ai_indicator_changed' , ( event ) => {
32- const { cid } = event ;
33- const state = event . state as AIStatesEnum ;
34- if ( channel . cid === cid ) {
35- setAiState ( state ) ;
36- }
37- } ) ;
31+ const indicatorChangedListener = channel . on (
32+ 'ai_indicator_changed' ,
33+ ( event : Event < StreamChatGenerics > ) => {
34+ const { cid } = event ;
35+ const state = event . state as AIStatesEnum ;
36+ if ( channel . cid === cid ) {
37+ setAiState ( state ) ;
38+ }
39+ } ,
40+ ) ;
3841
3942 const indicatorClearedListener = channel . on ( 'ai_indicator_clear' , ( event ) => {
4043 const { cid } = event ;
Original file line number Diff line number Diff line change 1- import type { ExtendableGenerics , LiteralStringForUnion } from 'stream-chat' ;
1+ import type { EventTypes , ExtendableGenerics , LiteralStringForUnion } from 'stream-chat' ;
22
33import type { FileStateValue } from '../utils/utils' ;
44
@@ -84,11 +84,17 @@ interface DefaultChannelType extends UnknownType {
8484 image ?: string ;
8585}
8686
87+ interface DefaultEventType extends UnknownType {
88+ [ key : string ] : unknown ;
89+
90+ type : EventTypes | 'ai_indicator_changed' | 'ai_indicator_clear' ;
91+ }
92+
8793export interface DefaultStreamChatGenerics extends ExtendableGenerics {
8894 attachmentType : DefaultAttachmentType ;
8995 channelType : DefaultChannelType ;
9096 commandType : LiteralStringForUnion ;
91- eventType : UnknownType ;
97+ eventType : DefaultEventType ;
9298 memberType : UnknownType ;
9399 messageType : UnknownType ;
94100 reactionType : UnknownType ;
You can’t perform that action at this time.
0 commit comments