Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
ref(TS) Improve TS (#13365)
Robert Pintilii06b67dcf4480
diff --git a/react/features/analytics/functions.ts b/react/features/analytics/functions.tsindex 313a5b82cb..935565f057 100644--- a/react/features/analytics/functions.ts+++ b/react/features/analytics/functions.ts@@ -173,7 +173,15 @@ export function initAnalytics(store: IStore, handlers: Array<Object>) {const { group, server } = state['features/base/jwt'];const { locationURL = { href: '' } } = state['features/base/connection'];const { tenant } = parseURIString(locationURL.href) || {};- const permanentProperties: any = {};+ const permanentProperties: {+ appName?: string;+ externalApi?: boolean;+ group?: string;+ inIframe?: boolean;+ server?: string;+ tenant?: string;+ websocket?: boolean;+ } & typeof deploymentInfo = {};if (server) {permanentProperties.server = server;@@ -202,7 +210,8 @@ export function initAnalytics(store: IStore, handlers: Array<Object>) {if (deploymentInfo) {for (const key in deploymentInfo) {if (deploymentInfo.hasOwnProperty(key)) {- permanentProperties[key] = deploymentInfo[key as keyof typeof deploymentInfo];+ permanentProperties[key as keyof typeof deploymentInfo] = deploymentInfo[+ key as keyof typeof deploymentInfo];}}}@@ -235,7 +244,7 @@ export function initAnalytics(store: IStore, handlers: Array<Object>) {* @returns {Promise} Resolves with the handlers that have been successfully loaded and rejects if there are no handlers* loaded or the analytics is disabled.*/-function _loadHandlers(scriptURLs: any[] = [], handlerConstructorOptions: Object) {+function _loadHandlers(scriptURLs: string[] = [], handlerConstructorOptions: Object) {const promises: Promise<{ error?: Error; type: string; url?: string; }>[] = [];for (const url of scriptURLs) {diff --git a/react/features/analytics/handlers/amplitude/fixDeviceID.native.ts b/react/features/analytics/handlers/amplitude/fixDeviceID.native.tsindex 3b812ae6cc..f5e8932316 100644--- a/react/features/analytics/handlers/amplitude/fixDeviceID.native.ts+++ b/react/features/analytics/handlers/amplitude/fixDeviceID.native.ts@@ -1,3 +1,4 @@+import { Amplitude } from '@amplitude/react-native';import DefaultPreference from 'react-native-default-preference';import DeviceInfo from 'react-native-device-info';@@ -7,7 +8,7 @@ import DeviceInfo from 'react-native-device-info';* @param {AmplitudeClient} amplitude - The amplitude instance.* @returns {void}*/-export async function fixDeviceID(amplitude: any) {+export async function fixDeviceID(amplitude: Amplitude) {await DefaultPreference.setName('jitsi-preferences');const current = await DefaultPreference.get('amplitudeDeviceId');diff --git a/react/features/analytics/handlers/amplitude/fixDeviceID.web.ts b/react/features/analytics/handlers/amplitude/fixDeviceID.web.tsindex 1b2c013ec7..beaa83b613 100644--- a/react/features/analytics/handlers/amplitude/fixDeviceID.web.ts+++ b/react/features/analytics/handlers/amplitude/fixDeviceID.web.ts@@ -1,9 +1,11 @@+import { AmplitudeClient } from 'amplitude-js';+/*** Custom logic for setting the correct device id.** @param {AmplitudeClient} _amplitude - The amplitude instance.* @returns {void}*/-export function fixDeviceID(_amplitude: any): Promise<any> {+export function fixDeviceID(_amplitude: AmplitudeClient): Promise<any> {return new Promise(resolve => resolve(true));}diff --git a/react/features/app/components/AbstractApp.ts b/react/features/app/components/AbstractApp.tsindex 310e5d1430..a280b1a990 100644--- a/react/features/app/components/AbstractApp.ts+++ b/react/features/app/components/AbstractApp.ts@@ -12,7 +12,7 @@ export interface IProps {* XXX Refer to the implementation of loadURLObject: in* ios/sdk/src/JitsiMeetView.m for further information.*/- timestamp: any;+ timestamp: number;/*** The URL, if any, with which the app was launched.diff --git a/react/features/app/components/App.web.tsx b/react/features/app/components/App.web.tsxindex 26b5003a02..119e0af608 100644--- a/react/features/app/components/App.web.tsx+++ b/react/features/app/components/App.web.tsx@@ -42,7 +42,7 @@ export class App extends AbstractApp {** @override*/- _createMainElement(component: React.ComponentType, props: any) {+ _createMainElement(component: React.ComponentType, props?: Object) {return (<JitsiThemeProvider><GlobalStyles />diff --git a/react/features/authentication/components/web/LoginDialog.tsx b/react/features/authentication/components/web/LoginDialog.tsxindex 44ee5fe957..b6291f80f8 100644--- a/react/features/authentication/components/web/LoginDialog.tsx+++ b/react/features/authentication/components/web/LoginDialog.tsx@@ -203,7 +203,7 @@ class LoginDialog extends Component<IProps, IState> {t} = this.props;const { username, password } = this.state;- const messageOptions: any = {};+ const messageOptions: { msg?: string; } = {};let messageKey;if (progress && progress < 1) {diff --git a/react/features/base/avatar/components/Avatar.tsx b/react/features/base/avatar/components/Avatar.tsxindex e684026cd5..758f91c96e 100644--- a/react/features/base/avatar/components/Avatar.tsx+++ b/react/features/base/avatar/components/Avatar.tsx@@ -239,7 +239,7 @@ class Avatar<P extends IProps> extends PureComponent<P, IState> {* @param {boolean} params.dontRetry - If false we will retry to load the Avatar with different CORS mode.* @returns {void}*/- _onAvatarLoadError(params: any = {}) {+ _onAvatarLoadError(params: { dontRetry?: boolean; } = {}) {const { dontRetry = false } = params;if (Boolean(this.props.useCORS) === this.state.isUsingCORS && !dontRetry) {diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.tsindex feb8e21b37..f71e257d9e 100644--- a/react/features/base/conference/reducer.ts+++ b/react/features/base/conference/reducer.ts@@ -1,3 +1,5 @@+import { AnyAction } from 'redux';+import { FaceLandmarks } from '../../face-landmarks/types';import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../room-lock/constants';import { ISpeakerStats } from '../../speaker-stats/reducer';@@ -148,6 +150,7 @@ export interface IConferenceState {}export interface IJitsiConferenceRoom {+ locked: boolean;myroomjid: string;roomjid: string;}@@ -266,7 +269,7 @@ function _conferenceFailed(state: IConferenceState, { conference, error }: {return state;}- let authRequired: any;+ let authRequired;let membersOnly;let passwordRequired;@@ -323,7 +326,7 @@ function _conferenceFailed(state: IConferenceState, { conference, error }: {* @returns {Object} The new state of the feature base/conference after the* reduction of the specified action.*/-function _conferenceJoined(state: IConferenceState, { conference }: { conference: any; }) {+function _conferenceJoined(state: IConferenceState, { conference }: { conference: IJitsiConference; }) {// FIXME The indicator which determines whether a JitsiConference is locked// i.e. password-protected is private to lib-jitsi-meet. However, the// library does not fire LOCK_STATE_CHANGED upon joining a JitsiConference@@ -462,7 +465,7 @@ function _lockStateChanged(state: IConferenceState, { conference, locked }: { co* @returns {Object} The new state of the feature base/conference after the* reduction of the specified action.*/-function _p2pStatusChanged(state: IConferenceState, action: any) {+function _p2pStatusChanged(state: IConferenceState, action: AnyAction) {return set(state, 'p2p', action.p2p);}@@ -476,7 +479,7 @@ function _p2pStatusChanged(state: IConferenceState, action: any) {* reduction of the specified action.*/function _setPassword(state: IConferenceState, { conference, method, password }: {- conference: any; method: Object; password: string; }) {+ conference: IJitsiConference; method: Object; password: string; }) {switch (method) {case conference.join:return assign(state, {@@ -523,7 +526,7 @@ function _setPassword(state: IConferenceState, { conference, method, password }:* @returns {Object} The new state of the feature base/conference after the* reduction of the specified action.*/-function _setRoom(state: IConferenceState, action: any) {+function _setRoom(state: IConferenceState, action: AnyAction) {let { room } = action;if (!isRoomValid(room)) {diff --git a/react/features/base/config/reducer.ts b/react/features/base/config/reducer.tsindex 0a84f33d5c..30225e6246 100644--- a/react/features/base/config/reducer.ts+++ b/react/features/base/config/reducer.ts@@ -64,7 +64,7 @@ const INITIAL_RN_STATE: IConfig = {* Mapping between old configs controlling the conference info headers visibility and the* new configs. Needed in order to keep backwards compatibility.*/-const CONFERENCE_HEADER_MAPPING: any = {+const CONFERENCE_HEADER_MAPPING = {hideConferenceTimer: [ 'conference-timer' ],hideConferenceSubject: [ 'subject' ],hideParticipantsStats: [ 'participants-count' ],@@ -388,9 +388,10 @@ function _translateLegacyConfig(oldValue: IConfig) {} else {newValue.conferenceInfo.alwaysVisible= (newValue.conferenceInfo.alwaysVisible ?? [])- .filter(c => !CONFERENCE_HEADER_MAPPING[key].includes(c));+ .filter(c => !CONFERENCE_HEADER_MAPPING[key as keyof typeof CONFERENCE_HEADER_MAPPING].includes(c));newValue.conferenceInfo.autoHide- = (newValue.conferenceInfo.autoHide ?? []).filter(c => !CONFERENCE_HEADER_MAPPING[key].includes(c));+ = (newValue.conferenceInfo.autoHide ?? []).filter(c =>+ !CONFERENCE_HEADER_MAPPING[key as keyof typeof CONFERENCE_HEADER_MAPPING].includes(c));}});}diff --git a/react/features/base/devices/actions.web.ts b/react/features/base/devices/actions.web.tsindex c0047e48e0..9c69d0f93e 100644--- a/react/features/base/devices/actions.web.ts+++ b/react/features/base/devices/actions.web.ts@@ -142,7 +142,7 @@ export function getAvailableDevices() {if (mediaDevices.isDeviceListAvailable()&& mediaDevices.isDeviceChangeAvailable()) {- mediaDevices.enumerateDevices((devices: any) => {+ mediaDevices.enumerateDevices((devices: MediaDeviceInfo[]) => {dispatch(updateDeviceList(devices));resolve(devices);diff --git a/react/features/base/flags/functions.ts b/react/features/base/flags/functions.tsindex 7282f73e75..79b0439b6f 100644--- a/react/features/base/flags/functions.ts+++ b/react/features/base/flags/functions.ts@@ -13,7 +13,7 @@ import { toState } from '../redux/functions';* @returns {*} The value of the specified React {@code Component} prop of the* currently mounted {@code App}.*/-export function getFeatureFlag(stateful: IStateful, flag: string, defaultValue?: any) {+export function getFeatureFlag(stateful: IStateful, flag: string, defaultValue?: boolean | string) {const state = toState(stateful)['features/base/flags'];if (state) {diff --git a/react/features/base/jwt/middleware.ts b/react/features/base/jwt/middleware.tsindex f722205961..c954a93f9f 100644--- a/react/features/base/jwt/middleware.ts+++ b/react/features/base/jwt/middleware.ts@@ -226,9 +226,15 @@ function _undoOverwriteLocalParticipant(* }}*/function _user2participant({ avatar, avatarUrl, email, id, name, 'hidden-from-recorder': hiddenFromRecorder }:- { avatar: any; avatarUrl: string; email: string; 'hidden-from-recorder': string | boolean;+ { avatar?: string; avatarUrl?: string; email: string; 'hidden-from-recorder': string | boolean;id: string; name: string; }) {- const participant: any = {};+ const participant: {+ avatarURL?: string;+ email?: string;+ hiddenFromRecorder?: boolean;+ id?: string;+ name?: string;+ } = {};if (typeof avatarUrl === 'string') {participant.avatarURL = avatarUrl.trim();diff --git a/react/features/base/logging/middleware.ts b/react/features/base/logging/middleware.tsindex 641ec7bea2..af8a20ed12 100644--- a/react/features/base/logging/middleware.ts+++ b/react/features/base/logging/middleware.ts@@ -1,5 +1,6 @@// @ts-expect-errorimport Logger from '@jitsi/logger';+import { AnyAction } from 'redux';import { IStore } from '../../app/types';import { APP_WILL_MOUNT } from '../app/actionTypes';@@ -61,7 +62,7 @@ MiddlewareRegistry.register(store => next => action => {* @returns {Object} The new state that is the result of the reduction of the* specified {@code action}.*/-function _appWillMount({ getState }: IStore, next: Function, action: any) {+function _appWillMount({ getState }: IStore, next: Function, action: AnyAction) {const { config } = getState()['features/base/logging'];_setLogLevels(Logger, config);@@ -87,7 +88,7 @@ function _appWillMount({ getState }: IStore, next: Function, action: any) {* @private* @returns {*}*/-function _conferenceJoined({ getState }: IStore, next: Function, action: any) {+function _conferenceJoined({ getState }: IStore, next: Function, action: AnyAction) {// Wait until the joined event is processed, so that the JitsiMeetLogStorage// will be ready.@@ -191,7 +192,7 @@ function _initLogging({ dispatch, getState }: IStore,* @returns {Object} The new state that is the result of the reduction of the* specified {@code action}.*/-function _libWillInit({ getState }: IStore, next: Function, action: any) {+function _libWillInit({ getState }: IStore, next: Function, action: AnyAction) {// Adding the if in order to preserve the logic for web after enabling// LIB_WILL_INIT action for web in initLib action.if (typeof APP === 'undefined') {@@ -215,7 +216,7 @@ function _libWillInit({ getState }: IStore, next: Function, action: any) {* @returns {Object} The new state that is the result of the reduction of the* specified action.*/-function _setConfig({ dispatch }: IStore, next: Function, action: any) {+function _setConfig({ dispatch }: IStore, next: Function, action: AnyAction) {const result = next(action);dispatch(setLoggingConfig(action.config?.logging));@@ -238,7 +239,7 @@ function _setConfig({ dispatch }: IStore, next: Function, action: any) {* specified {@code action}.*/function _setLoggingConfig({ dispatch, getState }: IStore,- next: Function, action: any) {+ next: Function, action: AnyAction) {const result = next(action);const newValue = getState()['features/base/logging'].config;const isTestingEnabled = isTestModeEnabled(getState());diff --git a/react/features/base/logging/reducer.ts b/react/features/base/logging/reducer.tsindex c6942ca1ca..28d81f6644 100644--- a/react/features/base/logging/reducer.ts+++ b/react/features/base/logging/reducer.ts@@ -1,4 +1,5 @@import _ from 'lodash';+import { AnyAction } from 'redux';import ReducerRegistry from '../redux/ReducerRegistry';import { equals, set } from '../redux/functions';@@ -94,7 +95,7 @@ ReducerRegistry.register<ILoggingState>(* @returns {Object} The new state of the feature base/logging after the* reduction of the specified action.*/-function _setLoggingConfig(state: ILoggingState, action: any) {+function _setLoggingConfig(state: ILoggingState, action: AnyAction) {const newConfig = _.merge({}, DEFAULT_STATE.config, action.config);if (equals(state.config, newConfig)) {@@ -117,6 +118,6 @@ function _setLoggingConfig(state: ILoggingState, action: any) {* @returns {Object} The new state of the feature base/logging after the* reduction of the specified action.*/-function _setLogCollector(state: ILoggingState, action: any) {+function _setLogCollector(state: ILoggingState, action: AnyAction) {return set(state, 'logCollector', action.logCollector);}diff --git a/react/features/base/media/middleware.web.ts b/react/features/base/media/middleware.web.tsindex c270edc8c3..a0bde1660c 100644--- a/react/features/base/media/middleware.web.ts+++ b/react/features/base/media/middleware.web.ts@@ -1,4 +1,5 @@import './middleware.any';+import { AnyAction } from 'redux';import { IStore } from '../../app/types';import { showNotification } from '../../notifications/actions';@@ -18,7 +19,7 @@ import './subscriber';* @param {IStore} store - The redux store.* @returns {Function}*/-MiddlewareRegistry.register((store: IStore) => (next: Function) => (action: any) => {+MiddlewareRegistry.register((store: IStore) => (next: Function) => (action: AnyAction) => {const { dispatch } = store;switch (action.type) {diff --git a/react/features/base/participants/actions.ts b/react/features/base/participants/actions.tsindex 4c336ab33c..650db59cda 100644--- a/react/features/base/participants/actions.ts+++ b/react/features/base/participants/actions.ts@@ -1,6 +1,7 @@import { IStore } from '../../app/types';import { showNotification } from '../../notifications/actions';import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';+import { IJitsiConference } from '../conference/reducer';import { set } from '../redux/functions';import {@@ -60,7 +61,7 @@ import { FakeParticipant, IJitsiParticipant, IParticipant } from './types';* }}*/export function dominantSpeakerChanged(- dominantSpeaker: string, previousSpeakers: string[], silence: boolean, conference: any) {+ dominantSpeaker: string, previousSpeakers: string[], silence: boolean, conference: IJitsiConference) {return {type: DOMINANT_SPEAKER_CHANGED,participant: {@@ -386,7 +387,9 @@ export function hiddenParticipantLeft(id: string) {* }* }}*/-export function participantLeft(id: string, conference: any, participantLeftProps: any = {}) {+export function participantLeft(id: string, conference?: IJitsiConference, participantLeftProps: {+ fakeParticipant?: string; isReplaced?: boolean;+} = {}) {return {type: PARTICIPANT_LEFT,participant: {@@ -516,7 +519,7 @@ export function participantMutedUs(participant: any, track: any) {* @param {JitsiConference} conference - The conference instance for which the participant is to be created.* @returns {Function}*/-export function createVirtualScreenshareParticipant(sourceName: string, local: boolean, conference: any) {+export function createVirtualScreenshareParticipant(sourceName: string, local: boolean, conference?: IJitsiConference) {return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {const state = getState();const ownerId = getVirtualScreenshareParticipantOwnerId(sourceName);diff --git a/react/features/base/participants/middleware.ts b/react/features/base/participants/middleware.tsindex e6a4b2cc85..d678fdd171 100644--- a/react/features/base/participants/middleware.ts+++ b/react/features/base/participants/middleware.ts@@ -1,5 +1,6 @@import i18n from 'i18next';import { batch } from 'react-redux';+import { AnyAction } from 'redux';// @ts-expect-errorimport UIEvents from '../../../../service/UI/UIEvents';@@ -543,7 +544,7 @@ function _e2eeUpdated({ getState, dispatch }: IStore, conference: IJitsiConferen* @private* @returns {Object} The value returned by {@code next(action)}.*/-function _localParticipantJoined({ getState, dispatch }: IStore, next: Function, action: any) {+function _localParticipantJoined({ getState, dispatch }: IStore, next: Function, action: AnyAction) {const result = next(action);const settings = getState()['features/base/settings'];@@ -569,7 +570,7 @@ function _localParticipantJoined({ getState, dispatch }: IStore, next: Function,* @private* @returns {Object} The value returned by {@code next(action)}.*/-function _localParticipantLeft({ dispatch }: IStore, next: Function, action: any) {+function _localParticipantLeft({ dispatch }: IStore, next: Function, action: AnyAction) {const result = next(action);dispatch(localParticipantLeft());@@ -586,7 +587,7 @@ function _localParticipantLeft({ dispatch }: IStore, next: Function, action: any* @private* @returns {void}*/-function _maybePlaySounds({ getState, dispatch }: IStore, action: any) {+function _maybePlaySounds({ getState, dispatch }: IStore, action: AnyAction) {const state = getState();const { startAudioMuted } = state['features/base/config'];const { soundsParticipantJoined: joinSound, soundsParticipantLeft: leftSound } = state['features/base/settings'];@@ -631,7 +632,7 @@ function _maybePlaySounds({ getState, dispatch }: IStore, action: any) {* @private* @returns {Object} The value returned by {@code next(action)}.*/-function _participantJoinedOrUpdated(store: IStore, next: Function, action: any) {+function _participantJoinedOrUpdated(store: IStore, next: Function, action: AnyAction) {const { dispatch, getState } = store;const { overwrittenNameList } = store.getState()['features/base/participants'];const { participant: {diff --git a/react/features/base/participants/types.ts b/react/features/base/participants/types.tsindex 98e8a04037..4b3b6e3bb3 100644--- a/react/features/base/participants/types.ts+++ b/react/features/base/participants/types.ts@@ -1,3 +1,5 @@+import { IJitsiConference } from '../conference/reducer';+export enum FakeParticipant {LocalScreenShare = 'LocalScreenShare',RemoteScreenShare = 'RemoteScreenShare',@@ -8,7 +10,7 @@ export enum FakeParticipant {export interface IParticipant {avatarURL?: string;botType?: string;- conference?: Object;+ conference?: IJitsiConference;displayName?: string;dominantSpeaker?: boolean;e2eeEnabled?: boolean;diff --git a/react/features/base/react/components/web/BaseIndicator.tsx b/react/features/base/react/components/web/BaseIndicator.tsxindex 77fb19bcfd..6e574b9a71 100644--- a/react/features/base/react/components/web/BaseIndicator.tsx+++ b/react/features/base/react/components/web/BaseIndicator.tsx@@ -88,7 +88,7 @@ const BaseIndicator = ({tooltipPosition = 'top'}: IProps) => {const { classes: styles } = useStyles();- const style: any = {};+ const style: { fontSize?: string | number; } = {};if (iconSize) {style.fontSize = iconSize;diff --git a/react/features/base/toolbox/components/web/ToolboxButtonWithIcon.tsx b/react/features/base/toolbox/components/web/ToolboxButtonWithIcon.tsxindex 9e80e69f45..915b8ecd52 100644--- a/react/features/base/toolbox/components/web/ToolboxButtonWithIcon.tsx+++ b/react/features/base/toolbox/components/web/ToolboxButtonWithIcon.tsx@@ -102,7 +102,15 @@ export default function ToolboxButtonWithIcon(props: IProps) {iconId} = props;- const iconProps: any = {};+ const iconProps: {+ ariaControls?: string;+ ariaExpanded?: boolean;+ containerId?: string;+ onClick?: (e?: React.MouseEvent) => void;+ onKeyDown?: Function;+ role?: string;+ tabIndex?: number;+ } = {};let className = '';if (iconDisabled) {@@ -110,7 +118,7 @@ export default function ToolboxButtonWithIcon(props: IProps) {= 'settings-button-small-icon settings-button-small-icon--disabled';} else {className = 'settings-button-small-icon';- iconProps.onClick = (e: React.MouseEvent) => {+ iconProps.onClick = (e?: React.MouseEvent) => {if (typeof APP !== 'undefined' && notifyMode) {APP.API.notifyToolbarButtonClicked(buttonKey, notifyMode === NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFYdiff --git a/react/features/base/toolbox/components/web/ToolboxButtonWithPopup.tsx b/react/features/base/toolbox/components/web/ToolboxButtonWithPopup.tsxindex f8de565616..6490cd2b58 100644--- a/react/features/base/toolbox/components/web/ToolboxButtonWithPopup.tsx+++ b/react/features/base/toolbox/components/web/ToolboxButtonWithPopup.tsx@@ -119,7 +119,14 @@ export default function ToolboxButtonWithPopup(props: IProps) {);}- const iconProps: any = {};+ const iconProps: {+ ariaControls?: string;+ ariaExpanded?: boolean;+ className?: string;+ containerId?: string;+ role?: string;+ tabIndex?: number;+ } = {};if (iconDisabled) {iconProps.className