Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

[flow] Expand the coverage of flow-monitored files

Lyubomir Marinovb50f858556d6
diff --git a/react/features/base/connection/functions.js b/react/features/base/connection/functions.js
index 292b848e7c..b69daa7dc2 100644
--- a/react/features/base/connection/functions.js
+++ b/react/features/base/connection/functions.js
@@ -1,3 +1,5 @@
+/* @flow */
+
/**
* Returns current domain.
*
@@ -5,7 +7,7 @@
* state.
* @returns {(string|undefined)}
*/
-export function getDomain(stateOrGetState) {
+export function getDomain(stateOrGetState: Function | Object) {
const state
= typeof stateOrGetState === 'function'
? stateOrGetState()
diff --git a/react/features/base/connection/reducer.js b/react/features/base/connection/reducer.js
index 1124c26c7a..739587dc72 100644
--- a/react/features/base/connection/reducer.js
+++ b/react/features/base/connection/reducer.js
@@ -1,3 +1,5 @@
+/* @flow */
+
import { ReducerRegistry, setStateProperty } from '../redux';
import {
@@ -9,20 +11,22 @@ import {
/**
* Reduces the Redux actions of the feature base/connection.
*/
-ReducerRegistry.register('features/base/connection', (state = {}, action) => {
- switch (action.type) {
- case CONNECTION_DISCONNECTED:
- return _connectionDisconnected(state, action);
+ReducerRegistry.register(
+ 'features/base/connection',
+ (state: Object = {}, action: Object) => {
+ switch (action.type) {
+ case CONNECTION_DISCONNECTED:
+ return _connectionDisconnected(state, action);
- case CONNECTION_ESTABLISHED:
- return _connectionEstablished(state, action);
+ case CONNECTION_ESTABLISHED:
+ return _connectionEstablished(state, action);
- case SET_DOMAIN:
- return _setDomain(state, action);
- }
+ case SET_DOMAIN:
+ return _setDomain(state, action);
+ }
- return state;
-});
+ return state;
+ });
/**
* Reduces a specific Redux action CONNECTION_DISCONNECTED of the feature
@@ -34,7 +38,7 @@ ReducerRegistry.register('features/base/connection', (state = {}, action) => {
* @returns {Object} The new state of the feature base/connection after the
* reduction of the specified action.
*/
-function _connectionDisconnected(state, action) {
+function _connectionDisconnected(state: Object, action: Object) {
if (state.connection === action.connection) {
return setStateProperty(state, 'connection', undefined);
}
@@ -52,7 +56,7 @@ function _connectionDisconnected(state, action) {
* @returns {Object} The new state of the feature base/connection after the
* reduction of the specified action.
*/
-function _connectionEstablished(state, action) {
+function _connectionEstablished(state: Object, action: Object) {
return setStateProperty(state, 'connection', action.connection);
}
@@ -65,7 +69,7 @@ function _connectionEstablished(state, action) {
* @private
* @returns {Object}
*/
-function _constructConnectionOptions(domain) {
+function _constructConnectionOptions(domain: string) {
// FIXME The HTTPS scheme for the BOSH URL works with meet.jit.si on both
// mobile & Web. It also works with beta.meet.jit.si on Web. Unfortunately,
// it doesn't work with beta.meet.jit.si on mobile. Temporarily, use the
@@ -89,7 +93,7 @@ function _constructConnectionOptions(domain) {
boshProtocol || (boshProtocol = 'https:');
return {
- bosh: `${boshProtocol}//${domain}/http-bind`,
+ bosh: `${String(boshProtocol)}//${domain}/http-bind`,
hosts: {
domain,
focus: `focus.${domain}`,
@@ -107,7 +111,7 @@ function _constructConnectionOptions(domain) {
* @returns {Object} The new state of the feature base/connection after the
* reduction of the specified action.
*/
-function _setDomain(state, action) {
+function _setDomain(state: Object, action: Object) {
return {
...state,
connectionOptions: {
diff --git a/react/features/base/media/middleware.js b/react/features/base/media/middleware.js
index 31da9e2b74..605eb0a61c 100644
--- a/react/features/base/media/middleware.js
+++ b/react/features/base/media/middleware.js
@@ -1,3 +1,5 @@
+/* @flow */
+
import { CONFERENCE_LEFT } from '../conference';
import { MiddlewareRegistry } from '../redux';
import { setTrackMuted, TRACK_ADDED } from '../tracks';
diff --git a/react/features/base/react/RouteRegistry.js b/react/features/base/react/RouteRegistry.js
index b2734801a3..58d9b0c3ac 100644
--- a/react/features/base/react/RouteRegistry.js
+++ b/react/features/base/react/RouteRegistry.js
@@ -19,7 +19,7 @@ type Route = {
* without needing to create additional inter-feature dependencies.
*/
class RouteRegistry {
- _elements: Route[];
+ _elements: Array<Route>;
/**
* Initializes a new RouteRegistry instance.
diff --git a/react/features/base/tracks/middleware.js b/react/features/base/tracks/middleware.js
index 1338f0d8ac..5e4259c117 100644
--- a/react/features/base/tracks/middleware.js
+++ b/react/features/base/tracks/middleware.js
@@ -1,3 +1,5 @@
+/* @flow */
+
import { LIB_DISPOSED, LIB_INITIALIZED } from '../lib-jitsi-meet';
import {
MEDIA_TYPE,
@@ -67,7 +69,7 @@ MiddlewareRegistry.register(store => next => action => {
* @returns {Track} The local <tt>Track</tt> associated with the specified
* <tt>mediaType</tt> in the specified <tt>store</tt>.
*/
-function _getLocalTrack(store, mediaType) {
+function _getLocalTrack(store, mediaType: MEDIA_TYPE) {
return getLocalTrack(store.getState()['features/base/tracks'], mediaType);
}
@@ -82,7 +84,7 @@ function _getLocalTrack(store, mediaType) {
* @private
* @returns {void}
*/
-function _setMuted(store, action, mediaType) {
+function _setMuted(store, action, mediaType: MEDIA_TYPE) {
const localTrack = _getLocalTrack(store, mediaType);
localTrack && setTrackMuted(localTrack.jitsiTrack, action.muted);
diff --git a/react/features/base/util/roomnameGenerator.js b/react/features/base/util/roomnameGenerator.js
index 14a8b65aad..1ae9e976af 100644
--- a/react/features/base/util/roomnameGenerator.js
+++ b/react/features/base/util/roomnameGenerator.js
@@ -152,7 +152,7 @@ const _CONJUNCTION_ = [
* Maps a string (category name) to the array of words from that category.
* @const
*/
-const CATEGORIES = {
+const CATEGORIES: { [key: string]: Array<string> } = {
_ADJECTIVE_,
_ADVERB_,
_PLURALNOUN_,