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: Convert some files to TS (#11947)
Robert Pintiliid3c7b074d4a0
diff --git a/react/features/base/audio-only/actions.js b/react/features/base/audio-only/actions.tssimilarity index 94%rename from react/features/base/audio-only/actions.jsrename to react/features/base/audio-only/actions.tsindex 102dfec76a..0ec93c40e9 100644--- a/react/features/base/audio-only/actions.js+++ b/react/features/base/audio-only/actions.ts@@ -1,15 +1,16 @@-// @flow-+/* eslint-disable lines-around-comment */import type { Dispatch } from 'redux';+// @ts-ignoreimport UIEvents from '../../../../service/UI/UIEvents';+// @ts-ignoreimport { createAudioOnlyChangedEvent, sendAnalytics } from '../../analytics';import { SET_AUDIO_ONLY } from './actionTypes';import logger from './logger';-declare var APP: Object;+declare let APP: any;/*** Sets the audio-only flag for the current JitsiConference.@@ -24,7 +25,7 @@ declare var APP: Object;* ensureVideoTrack: boolean* }}*/-export function setAudioOnly(audioOnly: boolean, ensureVideoTrack: boolean = false) {+export function setAudioOnly(audioOnly: boolean, ensureVideoTrack = false) {return (dispatch: Dispatch<any>, getState: Function) => {const { enabled: oldValue } = getState()['features/base/audio-only'];diff --git a/react/features/base/audio-only/logger.js b/react/features/base/audio-only/logger.tssimilarity index 91%rename from react/features/base/audio-only/logger.jsrename to react/features/base/audio-only/logger.tsindex 46f4687dff..28b8e9b912 100644--- a/react/features/base/audio-only/logger.js+++ b/react/features/base/audio-only/logger.ts@@ -1,5 +1,3 @@-// @flow-import { getLogger } from '../logging/functions';export default getLogger('features/base/audio-only');diff --git a/react/features/base/lib-jitsi-meet/index.js b/react/features/base/lib-jitsi-meet/index.tssimilarity index 99%rename from react/features/base/lib-jitsi-meet/index.jsrename to react/features/base/lib-jitsi-meet/index.tsindex 4ecaa0c6f8..a07116faee 100644--- a/react/features/base/lib-jitsi-meet/index.js+++ b/react/features/base/lib-jitsi-meet/index.ts@@ -1,5 +1,6 @@// Re-export JitsiMeetJS from the library lib-jitsi-meet to (the other features// of) the project jitsi-meet.+// @ts-ignoreimport JitsiMeetJS from './_';export { JitsiMeetJS as default };diff --git a/react/features/base/logging/ExternalApiLogTransport.js b/react/features/base/logging/ExternalApiLogTransport.tssimilarity index 75%rename from react/features/base/logging/ExternalApiLogTransport.jsrename to react/features/base/logging/ExternalApiLogTransport.tsindex 500cf23804..a4c70b1f45 100644--- a/react/features/base/logging/ExternalApiLogTransport.js+++ b/react/features/base/logging/ExternalApiLogTransport.ts@@ -1,6 +1,4 @@-// @flow--declare var APP: Object;+declare let APP: any;/*** Constructs a log transport object for use with external API.@@ -10,8 +8,8 @@ declare var APP: Object;* @returns {Object} - The transport object.*/function buildTransport(levels: Array<string>) {- return levels.reduce((logger, level) => {- logger[level] = (...args) => {+ return levels.reduce((logger: any, level) => {+ logger[level] = (...args: any) => {APP.API.notifyLog(level, args);};diff --git a/react/features/base/logging/JitsiMeetInMemoryLogStorage.js b/react/features/base/logging/JitsiMeetInMemoryLogStorage.tssimilarity index 94%rename from react/features/base/logging/JitsiMeetInMemoryLogStorage.jsrename to react/features/base/logging/JitsiMeetInMemoryLogStorage.tsindex cc2a49ef11..a083b2aacc 100644--- a/react/features/base/logging/JitsiMeetInMemoryLogStorage.js+++ b/react/features/base/logging/JitsiMeetInMemoryLogStorage.ts@@ -3,6 +3,7 @@**/export default class JitsiMeetInMemoryLogStorage {+ logs: string[] = [];/*** Creates new <tt>JitsiMeetInMemoryLogStorage</tt>.@@ -34,7 +35,7 @@ export default class JitsiMeetInMemoryLogStorage {* representing log lines or aggregated lines objects.* @returns {void}*/- storeLogs(logEntries) {+ storeLogs(logEntries: (string|{text: string})[]) {for (let i = 0, len = logEntries.length; i < len; i++) {const logEntry = logEntries[i];diff --git a/react/features/base/logging/JitsiMeetLogStorage.js b/react/features/base/logging/JitsiMeetLogStorage.tssimilarity index 94%rename from react/features/base/logging/JitsiMeetLogStorage.jsrename to react/features/base/logging/JitsiMeetLogStorage.tsindex 9021e52709..c5d05fa957 100644--- a/react/features/base/logging/JitsiMeetLogStorage.js+++ b/react/features/base/logging/JitsiMeetLogStorage.ts@@ -1,4 +1,4 @@-+// @ts-ignoreimport { getCurrentConference } from '../conference';/**@@ -6,13 +6,15 @@ import { getCurrentConference } from '../conference';* logs are sent to CallStats.*/export default class JitsiMeetLogStorage {+ counter: number;+ getState: Function;/*** Creates new <tt>JitsiMeetLogStorage</tt>.** @param {Function} getState - The Redux store's {@code getState} method.*/- constructor(getState) {+ constructor(getState: Function) {/*** Counts each log entry, increases on every batch log entry stored.*@@ -51,7 +53,7 @@ export default class JitsiMeetLogStorage {* representing log lines or aggregated lines objects.* @returns {void}*/- storeLogs(logEntries) {+ storeLogs(logEntries: Array<string|any>) {const conference = getCurrentConference(this.getState());if (!conference || !conference.isCallstatsEnabled()) {diff --git a/react/features/base/logging/LogTransport.native.js b/react/features/base/logging/LogTransport.native.tssimilarity index 90%rename from react/features/base/logging/LogTransport.native.jsrename to react/features/base/logging/LogTransport.native.tsindex 01ece062d4..4af8677a46 100644--- a/react/features/base/logging/LogTransport.native.js+++ b/react/features/base/logging/LogTransport.native.ts@@ -1,5 +1,3 @@-// @flow-import { NativeModules } from 'react-native';import { format } from 'util';@@ -14,7 +12,7 @@ const { LogBridge } = NativeModules;* @param {Error} e - The error.* @returns {string} - The stack trace.*/-function stackToString(e) {+function stackToString(e: any) {let ce;let s = e.stack;@@ -38,13 +36,15 @@ function buildTransport() {'log','warn','error'- ].reduce((logger, logName) => {+ ].reduce((logger: any, logName) => {logger[logName] = (timestamp: string, ...args: Array<string>) => {// It ignores the timestamp argument, because LogBridge will add it on the native side anyway- const nargs = args.map(arg => {+ const nargs = args.map((arg: any) => {if (arg instanceof Error) {const errorBody = {message: arg.message,++ // @ts-ignorecode: arg.code,stack: stackToString(arg)};diff --git a/react/features/base/logging/LogTransport.web.js b/react/features/base/logging/LogTransport.web.tssimilarity index 100%rename from react/features/base/logging/LogTransport.web.jsrename to react/features/base/logging/LogTransport.web.tsdiff --git a/react/features/base/logging/actions.js b/react/features/base/logging/actions.tssimilarity index 91%rename from react/features/base/logging/actions.jsrename to react/features/base/logging/actions.tsindex d909cda867..16dd75e29f 100644--- a/react/features/base/logging/actions.js+++ b/react/features/base/logging/actions.ts@@ -1,5 +1,3 @@-/* @flow */-import { SET_LOG_COLLECTOR, SET_LOGGING_CONFIG } from './actionTypes';/**@@ -13,7 +11,7 @@ import { SET_LOG_COLLECTOR, SET_LOGGING_CONFIG } from './actionTypes';* logCollector: Object* }}*/-export function setLogCollector(logCollector: ?Object) {+export function setLogCollector(logCollector?: Object) {return {type: SET_LOG_COLLECTOR,logCollectordiff --git a/react/features/base/logging/functions.js b/react/features/base/logging/functions.tssimilarity index 93%rename from react/features/base/logging/functions.jsrename to react/features/base/logging/functions.tsindex 211cbba1a6..7008447055 100644--- a/react/features/base/logging/functions.js+++ b/react/features/base/logging/functions.ts@@ -1,8 +1,8 @@-// @flow-+// @ts-ignoreimport Logger, { getLogger as _getLogger } from '@jitsi/logger';import _ from 'lodash';+// @ts-ignoreimport LogTransport from './LogTransport';/**@@ -33,6 +33,7 @@ export const _initLogging = _.once(() => {}// Lazy load it to avoid cycles in early web bootstrap code.+ // eslint-disable-next-line @typescript-eslint/no-var-requiresconst { default: JitsiMeetJS } = require('../lib-jitsi-meet/_');Logger.setGlobalOptions(DEFAULT_RN_OPTS);diff --git a/react/features/base/logging/middleware.js b/react/features/base/logging/middleware.tssimilarity index 91%rename from react/features/base/logging/middleware.jsrename to react/features/base/logging/middleware.tsindex 2a2b7213d9..e78edff95f 100644--- a/react/features/base/logging/middleware.js+++ b/react/features/base/logging/middleware.ts@@ -1,14 +1,16 @@-/* @flow */-+/* eslint-disable lines-around-comment */+// @ts-ignoreimport Logger from '@jitsi/logger';-import { APP_WILL_MOUNT } from '../app';+import { APP_WILL_MOUNT } from '../app/actionTypes';+// @ts-ignoreimport { CONFERENCE_JOINED, getCurrentConference } from '../conference';import JitsiMeetJS, {JitsiConferenceEvents} from '../lib-jitsi-meet';import { LIB_WILL_INIT } from '../lib-jitsi-meet/actionTypes';-import { MiddlewareRegistry } from '../redux';+import MiddlewareRegistry from '../redux/MiddlewareRegistry';+// @ts-ignoreimport { isTestModeEnabled } from '../testing';import buildExternalApiLogTransport from './ExternalApiLogTransport';@@ -17,7 +19,7 @@ import JitsiMeetLogStorage from './JitsiMeetLogStorage';import { SET_LOGGING_CONFIG } from './actionTypes';import { setLogCollector } from './actions';-declare var APP: Object;+declare let APP: any;/*** The Redux middleware of the feature base/logging.@@ -58,7 +60,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 }, next, action) {+function _appWillMount({ getState }: {getState: Function}, next: Function, action: any) {const { config } = getState()['features/base/logging'];_setLogLevels(Logger, config);@@ -84,7 +86,7 @@ function _appWillMount({ getState }, next, action) {* @private* @returns {*}*/-function _conferenceJoined({ getState }, next, action) {+function _conferenceJoined({ getState }: { getState: Function }, next: Function, action: any) {// Wait until the joined event is processed, so that the JitsiMeetLogStorage// will be ready.@@ -131,7 +133,8 @@ function _conferenceJoined({ getState }, next, action) {* @private* @returns {void}*/-function _initLogging({ dispatch, getState }, loggingConfig, isTestingEnabled) {+function _initLogging({ dispatch, getState }: {dispatch: Function, getState: Function},+ loggingConfig: any, isTestingEnabled: boolean) {const { logCollector } = getState()['features/base/logging'];// Create the LogCollector and register it as the global log transport. It@@ -188,7 +191,7 @@ function _initLogging({ dispatch, getState }, loggingConfig, isTestingEnabled) {* @returns {Object} The new state that is the result of the reduction of the* specified {@code action}.*/-function _libWillInit({ getState }, next, action) {+function _libWillInit({ getState }: { getState: Function }, next: Function, action: any) {// 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') {@@ -212,7 +215,8 @@ function _libWillInit({ getState }, next, action) {* @returns {Object} The new state that is the result of the reduction of the* specified {@code action}.*/-function _setLoggingConfig({ dispatch, getState }, next, action) {+function _setLoggingConfig({ dispatch, getState }: { dispatch: Function, getState: Function },+ next: Function, action: any) {const result = next(action);const newValue = getState()['features/base/logging'].config;const isTestingEnabled = isTestModeEnabled(getState());@@ -244,7 +248,7 @@ function _setLoggingConfig({ dispatch, getState }, next, action) {* @private* @returns {void}*/-function _setLogLevels(logger, config) {+function _setLogLevels(logger: any, config: any) {// XXX The loggers of the library lib-jitsi-meet and the application// jitsi-meet are separate, so the log levels have to be set in both.