Skip to content

Commit

Permalink
flow: tame the beast
Browse files Browse the repository at this point in the history
  • Loading branch information
saghul authored and lyubomir committed Jun 4, 2018
1 parent 9ac5aaf commit 0817482
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 33 deletions.
1 change: 1 addition & 0 deletions react/features/base/dialog/components/Dialog.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class Dialog extends AbstractDialog<Props, State> {
if (style
&& (style = StyleSheet.flatten(style))
&& _TAG_KEY in style) {
// $FlowFixMe
switch (style[_TAG_KEY]) {
case _SUBMIT_TEXT_TAG_VALUE:
if (this.state.submitting) {
Expand Down
4 changes: 2 additions & 2 deletions react/features/base/jwt/components/CalleeInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ class CalleeInfo extends Component<Props, State> {

_onLargeVideoAvatarVisible: Function;

_playAudioInterval: ?number;
_playAudioInterval: *;

_ringingTimeout: ?number
_ringingTimeout: *;

_setAudio: Function;

Expand Down
5 changes: 3 additions & 2 deletions react/features/base/media/components/native/VideoTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import React, { Component } from 'react';
import { PanResponder, PixelRatio, View } from 'react-native';
import { connect } from 'react-redux';
import { type Dispatch } from 'redux';

import { storeVideoTransform } from '../../actions';
import styles from './styles';
Expand Down Expand Up @@ -684,7 +685,7 @@ class VideoTransform extends Component<Props, State> {
* _onUnmount: Function
* }}
*/
function _mapDispatchToProps(dispatch) {
function _mapDispatchToProps(dispatch: Dispatch<*>) {
return {
/**
* Dispatches actions to store the last applied transform to a video.
Expand Down Expand Up @@ -712,7 +713,7 @@ function _mapDispatchToProps(dispatch) {
function _mapStateToProps(state) {
return {
/**
* The stored transforms retreived from Redux to be initially applied to
* The stored transforms retrieved from Redux to be initially applied to
* different streams.
*
* @private
Expand Down
12 changes: 6 additions & 6 deletions react/features/base/react/components/native/Header.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import React, { Component } from 'react';
import React, { Component, type Node } from 'react';
import { Platform, SafeAreaView, StatusBar, View } from 'react-native';

import styles, { HEADER_PADDING, STATUSBAR_COLOR } from './styles';
Expand All @@ -11,14 +11,14 @@ import styles, { HEADER_PADDING, STATUSBAR_COLOR } from './styles';
const IOS10_PADDING = 20;

/**
* The type of the React {@code Component} props of {@link ScreenHeader}
* The type of the React {@code Component} props of {@link Header}
*/
type Props = {

/**
* Children component(s).
*/
children: React$Node,
children: Node,

/**
* The component's external style
Expand All @@ -37,7 +37,7 @@ export default class Header extends Component<Props> {
*
* @returns {Object}
*/
static get buttonStyle() {
static get buttonStyle(): Object {
return styles.headerButton;
}

Expand All @@ -47,7 +47,7 @@ export default class Header extends Component<Props> {
*
* @returns {Object}
*/
static get pageStyle() {
static get pageStyle(): Object {
return styles.page;
}

Expand All @@ -56,7 +56,7 @@ export default class Header extends Component<Props> {
*
* @returns {Object}
*/
static get textStyle() {
static get textStyle(): Object {
return styles.headerText;
}

Expand Down
4 changes: 2 additions & 2 deletions react/features/base/responsive-ui/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const REDUCED_UI_THRESHOLD = 300;
* aspectRatio: Symbol
* }}
*/
export function setAspectRatio(width: number, height: number): Object {
export function setAspectRatio(width: number, height: number): Function {
return (dispatch: Dispatch<*>, getState: Function) => {
// Don't change the aspect ratio if width and height are the same, that
// is, if we transition to a 1:1 aspect ratio.
Expand Down Expand Up @@ -59,7 +59,7 @@ export function setAspectRatio(width: number, height: number): Object {
* reducedUI: boolean
* }}
*/
export function setReducedUI(width: number, height: number) {
export function setReducedUI(width: number, height: number): Function {
return (dispatch: Dispatch<*>, getState: Function) => {
const reducedUI = Math.min(width, height) < REDUCED_UI_THRESHOLD;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function makeAspectRatioAware(
}
}

// $FlowFixMe
return connect(_mapStateToProps)(AspectRatioAware);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// @flow

import React, { Component } from 'react';
import React, { Component, type Node } from 'react';
import { connect } from 'react-redux';
import { type Dispatch } from 'redux';

import { setAspectRatio } from '../actions';
import DimensionsDetector from './DimensionsDetector';
Expand All @@ -19,7 +20,7 @@ type Props = {
/**
* Any nested components.
*/
children: React$Node
children: Node
};

/**
Expand Down Expand Up @@ -51,7 +52,7 @@ class AspectRatioDetector extends Component<Props> {
* _onDimensionsChanged: Function
* }}
*/
function _mapDispatchToProps(dispatch) {
function _mapDispatchToProps(dispatch: Dispatch<*>) {
return {
/**
* Handles the "on dimensions changed" event and dispatches aspect ratio
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// @flow

import React, { Component } from 'react';
import React, { Component, type Node } from 'react';
import { connect } from 'react-redux';
import { type Dispatch } from 'redux';

import { setReducedUI } from '../actions';
import DimensionsDetector from './DimensionsDetector';
Expand All @@ -20,7 +21,7 @@ type Props = {
/**
* Any nested components.
*/
children: React$Node
children: Node
};

/**
Expand Down Expand Up @@ -52,7 +53,7 @@ class ReducedUIDetector extends Component<Props> {
* _onDimensionsChanged: Function
* }}
*/
function _mapDispatchToProps(dispatch) {
function _mapDispatchToProps(dispatch: Dispatch<*>) {
return {
/**
* Handles the "on dimensions changed" event and dispatches the
Expand Down
3 changes: 1 addition & 2 deletions react/features/base/testing/components/TestConnectionInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ type State = {
* a good thing).
*/
class TestConnectionInfo extends Component<Props, State> {

_onStatsUpdated: Object => void
_onStatsUpdated: Object => void;

/**
* Initializes new <tt>TestConnectionInfo</tt> instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ type State = {
* screen when another meeting is about to start.
*/
class ConferenceNotification extends Component<Props, State> {
updateIntervalId: number;
updateIntervalId: *;

/**
* Constructor of the ConferenceNotification component.
*
* @inheritdoc
*/
constructor(props) {
constructor(props: Props) {
super(props);

this.state = {
Expand Down Expand Up @@ -97,7 +97,7 @@ class ConferenceNotification extends Component<Props, State> {
* @inheritdoc
*/
componentWillUnmount() {
clearTimeout(this.updateIntervalId);
clearInterval(this.updateIntervalId);
}

/**
Expand Down Expand Up @@ -160,7 +160,7 @@ class ConferenceNotification extends Component<Props, State> {
return null;
}

_getNotificationContentStyle: () => Array<Object>
_getNotificationContentStyle: () => Array<Object>;

/**
* Decides the color of the notification and some additional
Expand Down Expand Up @@ -251,7 +251,6 @@ class ConferenceNotification extends Component<Props, State> {
/**
* Opens the meeting URL that the notification shows.
*
* @param {string} url - The URL to open.
* @private
* @returns {void}
*/
Expand Down
3 changes: 2 additions & 1 deletion react/features/invite/components/InviteButton.native.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow

import { connect } from 'react-redux';
import type { Dispatch } from 'redux';

import { AbstractButton } from '../../base/toolbox';
import type { AbstractButtonProps } from '../../base/toolbox';
Expand Down Expand Up @@ -105,7 +106,7 @@ class InviteButton extends AbstractButton<Props, *> {
* }}
* @private
*/
function _mapDispatchToProps(dispatch) {
function _mapDispatchToProps(dispatch: Dispatch<*>) {
return {
/**
* Launches native invite dialog.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type Props = {
export class LargeVideoBackgroundCanvas extends Component<Props> {
_canvasEl: Object;

_updateCanvasInterval: number;
_updateCanvasInterval: *;

/**
* Initializes new {@code LargeVideoBackgroundCanvas} instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
* @returns {boolean} - If this overlay needs to be rendered, {@code true};
* {@code false}, otherwise.
*/
static needsRender(state) {
static needsRender(state: Object) {
const conferenceError = state['features/base/conference'].error;
const configError = state['features/base/config'].error;
const connectionError = state['features/base/connection'].error;
Expand All @@ -88,7 +88,7 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
|| configError);
}

_interval: ?number
_interval: *;

state: {

Expand Down Expand Up @@ -120,7 +120,7 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
* @type {string}
*/
title: string
}
};

/**
* Initializes a new AbstractPageReloadOverlay instance.
Expand Down Expand Up @@ -222,7 +222,7 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
}

/**
* Renders the button for relaod the page if necessary.
* Renders the button for reloading the page if necessary.
*
* @protected
* @returns {ReactElement|null}
Expand Down
2 changes: 1 addition & 1 deletion react/features/recording/components/RecordingLabel.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ type State = {
* @extends {Component}
*/
class RecordingLabel extends AbstractRecordingLabel<Props, State> {
_autohideTimeout: number;
_autohideTimeout: *;

state = {
hidden: false
Expand Down
2 changes: 1 addition & 1 deletion react/features/speaker-stats/components/SpeakerStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SpeakerStats extends Component<*, *> {
stats: {}
};

_updateInterval: number;
_updateInterval: *;

/**
* Initializes a new SpeakerStats instance.
Expand Down

0 comments on commit 0817482

Please sign in to comment.