From fd4e22991ac42c58aec1041d7600ef31eca3c27f Mon Sep 17 00:00:00 2001 From: Hristo Terezov Date: Wed, 21 Aug 2024 11:42:28 -0500 Subject: [PATCH] fix(subtitles): ITranscriptMessage type. --- react/features/subtitles/middleware.ts | 4 ++-- react/features/subtitles/reducer.ts | 10 ++-------- react/features/subtitles/types.ts | 11 +++++++++++ 3 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 react/features/subtitles/types.ts diff --git a/react/features/subtitles/middleware.ts b/react/features/subtitles/middleware.ts index 07a29e8a6db..85c8c8b8137 100644 --- a/react/features/subtitles/middleware.ts +++ b/react/features/subtitles/middleware.ts @@ -13,6 +13,7 @@ import { updateTranscriptMessage } from './actions.any'; import { notifyTranscriptionChunkReceived } from './functions'; +import { ITranscriptMessage } from './types'; /** @@ -188,9 +189,8 @@ function _endpointMessageReceived(store: IStore, next: Function, action: AnyActi // message ID or adds a new transcript message if it does not // exist in the map. const existingMessage = state['features/subtitles']._transcriptMessages.get(transcriptMessageID); - const newTranscriptMessage: any = { + const newTranscriptMessage: ITranscriptMessage = { clearTimeOut: existingMessage?.clearTimeOut, - language, participant }; diff --git a/react/features/subtitles/reducer.ts b/react/features/subtitles/reducer.ts index 44e07aeed6c..1a679a14e76 100644 --- a/react/features/subtitles/reducer.ts +++ b/react/features/subtitles/reducer.ts @@ -6,6 +6,7 @@ import { TOGGLE_REQUESTING_SUBTITLES, UPDATE_TRANSCRIPT_MESSAGE } from './actionTypes'; +import { ITranscriptMessage } from './types'; /** * Default State for 'features/transcription' feature. @@ -17,18 +18,11 @@ const defaultState = { _language: null }; -interface ITranscriptMessage { - final: string; - participantName: string; - stable: string; - unstable: string; -} - export interface ISubtitlesState { _displaySubtitles: boolean; _language: string | null; _requestingSubtitles: boolean; - _transcriptMessages: Map | any; + _transcriptMessages: Map; } /** diff --git a/react/features/subtitles/types.ts b/react/features/subtitles/types.ts new file mode 100644 index 00000000000..fe672940371 --- /dev/null +++ b/react/features/subtitles/types.ts @@ -0,0 +1,11 @@ +export interface ITranscriptMessage { + clearTimeOut?: number; + final?: string; + participant: { + avatarUrl?: string; + id?: string; + name?: string; + }; + stable?: string; + unstable?: string; +}