[flow] Expand the coverage of flow-monitored files

This commit is contained in:
Lyubomir Marinov 2017-02-03 12:51:12 -06:00 committed by hristoterezov
parent 5de1a74429
commit b50f858556
6 changed files with 31 additions and 21 deletions

View File

@ -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()

View File

@ -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: {

View File

@ -1,3 +1,5 @@
/* @flow */
import { CONFERENCE_LEFT } from '../conference';
import { MiddlewareRegistry } from '../redux';
import { setTrackMuted, TRACK_ADDED } from '../tracks';

View File

@ -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.

View File

@ -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);

View File

@ -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_,