ref(TS) Remove ts-ignores (#11979)

This commit is contained in:
Robert Pintilii 2022-08-08 12:36:06 +03:00 committed by GitHub
parent 43578474a0
commit 8f5eabe1f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 56 additions and 89 deletions

View File

@ -2,7 +2,7 @@
// @ts-ignore // @ts-ignore
import { getGravatarURL } from '@jitsi/js-utils/avatar'; import { getGravatarURL } from '@jitsi/js-utils/avatar';
import { IStore } from '../../app/types'; import { IState, IStore } from '../../app/types';
// @ts-ignore // @ts-ignore
import { isStageFilmstripAvailable } from '../../filmstrip/functions'; import { isStageFilmstripAvailable } from '../../filmstrip/functions';
import { GRAVATAR_BASE_URL } from '../avatar/constants'; import { GRAVATAR_BASE_URL } from '../avatar/constants';
@ -508,7 +508,7 @@ export function isIconUrl(icon?: string | Object) {
* to the Redux state. * to the Redux state.
* @returns {boolean} * @returns {boolean}
*/ */
export function isLocalParticipantModerator(stateful: IStore | Function) { export function isLocalParticipantModerator(stateful: IStore | Function | IState) {
const state = toState(stateful)['features/base/participants']; const state = toState(stateful)['features/base/participants'];
const { local } = state; const { local } = state;

View File

@ -1,7 +1,7 @@
import _ from 'lodash'; import _ from 'lodash';
import { connect as reduxConnect } from 'react-redux'; import { connect as reduxConnect } from 'react-redux';
import { IStore } from '../../app/types'; import { IState, IStore } from '../../app/types';
/** /**
* Sets specific properties of a specific state to specific values and prevents * Sets specific properties of a specific state to specific values and prevents
@ -135,12 +135,13 @@ function _set<T extends Object>(
* returned. * returned.
* @returns {Object} The redux state. * @returns {Object} The redux state.
*/ */
export function toState(stateful: Function | IStore) { export function toState(stateful: Function | IStore | IState) {
if (stateful) { if (stateful) {
if (typeof stateful === 'function') { if (typeof stateful === 'function') {
return stateful(); return stateful();
} }
// @ts-ignore
const { getState } = stateful; const { getState } = stateful;
if (typeof getState === 'function') { if (typeof getState === 'function') {

View File

@ -1,6 +1,5 @@
/* eslint-disable lines-around-comment */ /* eslint-disable lines-around-comment */
// @ts-ignore import { translate } from '../../../../base/i18n/functions';
import { translate } from '../../../../base/i18n';
// @ts-ignore // @ts-ignore
import { IconSettings } from '../../../../base/icons'; import { IconSettings } from '../../../../base/icons';
// @ts-ignore // @ts-ignore
@ -31,4 +30,5 @@ class SettingsButton extends AbstractButton<AbstractButtonProps, any, any> {
} }
} }
// @ts-ignore
export default translate(SettingsButton); export default translate(SettingsButton);

View File

@ -1,11 +1,11 @@
/* eslint-disable lines-around-comment */ /* eslint-disable lines-around-comment */
import React, { Component } from 'react'; import React, { Component } from 'react';
import { WithTranslation } from 'react-i18next';
import type { Dispatch } from 'redux'; import type { Dispatch } from 'redux';
// @ts-ignore // @ts-ignore
import { createE2EEEvent, sendAnalytics } from '../../analytics'; import { createE2EEEvent, sendAnalytics } from '../../analytics';
// @ts-ignore import { translate } from '../../base/i18n/functions';
import { translate } from '../../base/i18n';
import { connect } from '../../base/redux/functions'; import { connect } from '../../base/redux/functions';
import Switch from '../../base/ui/components/web/Switch'; import Switch from '../../base/ui/components/web/Switch';
// @ts-ignore // @ts-ignore
@ -15,7 +15,7 @@ import { MAX_MODE } from '../constants';
// @ts-ignore // @ts-ignore
import { doesEveryoneSupportE2EE } from '../functions'; import { doesEveryoneSupportE2EE } from '../functions';
type Props = { interface Props extends WithTranslation {
/** /**
* The resource for the description, computed based on the maxMode and whether the switch is toggled or not. * The resource for the description, computed based on the maxMode and whether the switch is toggled or not.
@ -45,13 +45,8 @@ type Props = {
/** /**
* The redux {@code dispatch} function. * The redux {@code dispatch} function.
*/ */
dispatch: Dispatch<any>, dispatch: Dispatch<any>
}
/**
* Invoked to obtain translated strings.
*/
t: Function
};
type State = { type State = {

View File

@ -1,8 +1,8 @@
/* eslint-disable lines-around-comment */ /* eslint-disable lines-around-comment */
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { WithTranslation } from 'react-i18next';
// @ts-ignore import { translate } from '../../../base/i18n/functions';
import { translate } from '../../../base/i18n';
import { isLocalParticipantModerator } from '../../../base/participants/functions'; import { isLocalParticipantModerator } from '../../../base/participants/functions';
import { connect } from '../../../base/redux/functions'; import { connect } from '../../../base/redux/functions';
import Switch from '../../../base/ui/components/web/Switch'; import Switch from '../../../base/ui/components/web/Switch';
@ -11,7 +11,7 @@ import { isInBreakoutRoom } from '../../../breakout-rooms/functions';
// @ts-ignore // @ts-ignore
import { toggleLobbyMode } from '../../actions'; import { toggleLobbyMode } from '../../actions';
type Props = { interface Props extends WithTranslation {
/** /**
* True if lobby is currently enabled in the conference. * True if lobby is currently enabled in the conference.
@ -26,13 +26,8 @@ type Props = {
/** /**
* The Redux Dispatch function. * The Redux Dispatch function.
*/ */
dispatch: Function, dispatch: Function
}
/**
* Function to be used to translate i18n labels.
*/
t: Function
};
type State = { type State = {

View File

@ -1,7 +1,6 @@
/* eslint-disable lines-around-comment */ /* eslint-disable lines-around-comment */
import { IState } from '../../app/types'; import { IState } from '../../app/types';
// @ts-ignore import { translate } from '../../base/i18n/functions';
import { translate } from '../../base/i18n';
import { import {
IconNoiseSuppressionOn, IconNoiseSuppressionOn,
IconNoiseSuppressionOff IconNoiseSuppressionOff

View File

@ -1,5 +1,6 @@
/* eslint-disable lines-around-comment */ /* eslint-disable lines-around-comment */
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { WithTranslation } from 'react-i18next';
import { Text, View } from 'react-native'; import { Text, View } from 'react-native';
// @ts-ignore // @ts-ignore
@ -8,8 +9,7 @@ import { Avatar } from '../../../base/avatar';
import { BottomSheet, hideSheet } from '../../../base/dialog'; import { BottomSheet, hideSheet } from '../../../base/dialog';
// @ts-ignore // @ts-ignore
import { bottomSheetStyles } from '../../../base/dialog/components/native/styles'; import { bottomSheetStyles } from '../../../base/dialog/components/native/styles';
// @ts-ignore import { translate } from '../../../base/i18n/functions';
import { translate } from '../../../base/i18n';
import { connect } from '../../../base/redux/functions'; import { connect } from '../../../base/redux/functions';
// @ts-ignore // @ts-ignore
import { getBreakoutRooms } from '../../../breakout-rooms/functions'; import { getBreakoutRooms } from '../../../breakout-rooms/functions';
@ -23,7 +23,7 @@ import styles from '../../../video-menu/components/native/styles';
*/ */
const AVATAR_SIZE = 24; const AVATAR_SIZE = 24;
type Props = { interface Props extends WithTranslation {
/** /**
* The list of all breakout rooms. * The list of all breakout rooms.
@ -48,12 +48,7 @@ type Props = {
/** /**
* The room the participant is in. * The room the participant is in.
*/ */
room: any, room: any
/**
* Translation function.
*/
t: Function
} }
/** /**

View File

@ -2,6 +2,7 @@
import { withStyles } from '@material-ui/styles'; import { withStyles } from '@material-ui/styles';
import clsx from 'clsx'; import clsx from 'clsx';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { WithTranslation } from 'react-i18next';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { import {
@ -14,11 +15,9 @@ import {
import { IStore } from '../../../app/types'; import { IStore } from '../../../app/types';
import { isMobileBrowser } from '../../../base/environment/utils'; import { isMobileBrowser } from '../../../base/environment/utils';
// @ts-ignore
import { translate } from '../../../base/i18n';
import { getLocalParticipant, hasRaisedHand } from '../../../base/participants/functions'; import { getLocalParticipant, hasRaisedHand } from '../../../base/participants/functions';
import { raiseHand } from '../../../base/participants/actions'; import { raiseHand } from '../../../base/participants/actions';
import { translate } from '../../../base/i18n/functions';
import { connect } from '../../../base/redux/functions'; import { connect } from '../../../base/redux/functions';
import { Theme } from '../../../base/ui/types'; import { Theme } from '../../../base/ui/types';
@ -42,7 +41,7 @@ interface Classes {
overflow: string overflow: string
} }
type Props = { interface Props extends WithTranslation {
/** /**
* Docks the toolbox. * Docks the toolbox.
@ -87,13 +86,8 @@ type Props = {
/** /**
* Whether or not it's displayed in the overflow menu. * Whether or not it's displayed in the overflow menu.
*/ */
overflowMenu: boolean, overflowMenu: boolean
}
/**
* Used for translation.
*/
t: Function
};
const styles = (theme: Theme) => { const styles = (theme: Theme) => {
return { return {

View File

@ -1,11 +1,10 @@
/* eslint-disable import/order */ /* eslint-disable import/order */
import React, { useCallback } from 'react'; import React, { useCallback } from 'react';
import { WithTranslation } from 'react-i18next';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { isMobileBrowser } from '../../../base/environment/utils'; import { isMobileBrowser } from '../../../base/environment/utils';
import { translate } from '../../../base/i18n/functions';
// @ts-ignore
import { translate } from '../../../base/i18n';
import { IconArrowUp } from '../../../base/icons/svg/index'; import { IconArrowUp } from '../../../base/icons/svg/index';
import { connect } from '../../../base/redux/functions'; import { connect } from '../../../base/redux/functions';
@ -21,7 +20,7 @@ import RaiseHandButton from './RaiseHandButton';
import ReactionEmoji from './ReactionEmoji'; import ReactionEmoji from './ReactionEmoji';
import ReactionsMenu from './ReactionsMenu'; import ReactionsMenu from './ReactionsMenu';
type Props = { interface Props extends WithTranslation {
/** /**
* Whether or not reactions are enabled. * Whether or not reactions are enabled.
@ -62,13 +61,8 @@ type Props = {
/** /**
* The array of reactions to be displayed. * The array of reactions to be displayed.
*/ */
reactionsQueue: Array<ReactionEmojiProps>, reactionsQueue: Array<ReactionEmojiProps>
}
/**
* Used for translation.
*/
t: Function
};
/** /**
* Button used for the reactions menu. * Button used for the reactions menu.

View File

@ -1,18 +1,18 @@
/* eslint-disable lines-around-comment */ /* eslint-disable lines-around-comment */
import React from 'react'; import React from 'react';
import { WithTranslation } from 'react-i18next';
// @ts-ignore // @ts-ignore
import { AbstractDialogTab } from '../../../base/dialog'; import { AbstractDialogTab } from '../../../base/dialog';
// @ts-ignore // @ts-ignore
import type { Props as AbstractDialogTabProps } from '../../../base/dialog'; import type { Props as AbstractDialogTabProps } from '../../../base/dialog';
// @ts-ignore import { translate } from '../../../base/i18n/functions';
import { translate } from '../../../base/i18n';
import Checkbox from '../../../base/ui/components/web/Checkbox'; import Checkbox from '../../../base/ui/components/web/Checkbox';
/** /**
* The type of the React {@code Component} props of {@link MoreTab}. * The type of the React {@code Component} props of {@link MoreTab}.
*/ */
export type Props = AbstractDialogTabProps & { export type Props = AbstractDialogTabProps & WithTranslation & {
/** /**
* If set hides the reactions moderation setting. * If set hides the reactions moderation setting.
@ -187,4 +187,5 @@ class ModeratorTab extends AbstractDialogTab<Props> {
} }
} }
// @ts-ignore
export default translate(ModeratorTab); export default translate(ModeratorTab);

View File

@ -4,6 +4,7 @@ import DropdownMenu, {
DropdownItemGroup DropdownItemGroup
} from '@atlaskit/dropdown-menu'; } from '@atlaskit/dropdown-menu';
import React from 'react'; import React from 'react';
import { WithTranslation } from 'react-i18next';
// @ts-ignore // @ts-ignore
import keyboardShortcut from '../../../../../modules/keyboardshortcut/keyboardshortcut'; import keyboardShortcut from '../../../../../modules/keyboardshortcut/keyboardshortcut';
@ -11,8 +12,7 @@ import keyboardShortcut from '../../../../../modules/keyboardshortcut/keyboardsh
import { AbstractDialogTab } from '../../../base/dialog'; import { AbstractDialogTab } from '../../../base/dialog';
// @ts-ignore // @ts-ignore
import type { Props as AbstractDialogTabProps } from '../../../base/dialog'; import type { Props as AbstractDialogTabProps } from '../../../base/dialog';
// @ts-ignore import { translate } from '../../../base/i18n/functions';
import { translate } from '../../../base/i18n';
import Checkbox from '../../../base/ui/components/web/Checkbox'; import Checkbox from '../../../base/ui/components/web/Checkbox';
// @ts-ignore // @ts-ignore
import TouchmoveHack from '../../../chat/components/web/TouchmoveHack'; import TouchmoveHack from '../../../chat/components/web/TouchmoveHack';
@ -24,7 +24,7 @@ import { SS_DEFAULT_FRAME_RATE } from '../../constants';
/** /**
* The type of the React {@code Component} props of {@link MoreTab}. * The type of the React {@code Component} props of {@link MoreTab}.
*/ */
export type Props = AbstractDialogTabProps & { export type Props = AbstractDialogTabProps & WithTranslation & {
/** /**
* The currently selected desktop share frame rate in the frame rate select dropdown. * The currently selected desktop share frame rate in the frame rate select dropdown.
@ -617,4 +617,5 @@ class MoreTab extends AbstractDialogTab<Props, State> {
} }
} }
// @ts-ignore
export default translate(MoreTab); export default translate(MoreTab);

View File

@ -1,5 +1,6 @@
/* eslint-disable lines-around-comment */ /* eslint-disable lines-around-comment */
import React from 'react'; import React from 'react';
import { WithTranslation } from 'react-i18next';
// @ts-ignore // @ts-ignore
import UIEvents from '../../../../../service/UI/UIEvents'; import UIEvents from '../../../../../service/UI/UIEvents';
@ -12,8 +13,7 @@ import {
import { AbstractDialogTab } from '../../../base/dialog'; import { AbstractDialogTab } from '../../../base/dialog';
// @ts-ignore // @ts-ignore
import type { Props as AbstractDialogTabProps } from '../../../base/dialog'; import type { Props as AbstractDialogTabProps } from '../../../base/dialog';
// @ts-ignore import { translate } from '../../../base/i18n/functions';
import { translate } from '../../../base/i18n';
import { Button } from '../../../base/ui/components/web'; import { Button } from '../../../base/ui/components/web';
import Input from '../../../base/ui/components/web/Input'; import Input from '../../../base/ui/components/web/Input';
// @ts-ignore // @ts-ignore
@ -25,7 +25,7 @@ declare var APP: any;
/** /**
* The type of the React {@code Component} props of {@link ProfileTab}. * The type of the React {@code Component} props of {@link ProfileTab}.
*/ */
export type Props = AbstractDialogTabProps & { export type Props = AbstractDialogTabProps & WithTranslation & {
/** /**
* Whether or not server-side authentication is available. * Whether or not server-side authentication is available.
@ -211,4 +211,5 @@ class ProfileTab extends AbstractDialogTab<Props> {
} }
} }
// @ts-ignore
export default translate(ProfileTab); export default translate(ProfileTab);

View File

@ -1,18 +1,18 @@
/* eslint-disable lines-around-comment */ /* eslint-disable lines-around-comment */
import React from 'react'; import React from 'react';
import { WithTranslation } from 'react-i18next';
// @ts-ignore // @ts-ignore
import { AbstractDialogTab } from '../../../base/dialog'; import { AbstractDialogTab } from '../../../base/dialog';
// @ts-ignore // @ts-ignore
import type { Props as AbstractDialogTabProps } from '../../../base/dialog'; import type { Props as AbstractDialogTabProps } from '../../../base/dialog';
// @ts-ignore import { translate } from '../../../base/i18n/functions';
import { translate } from '../../../base/i18n';
import Checkbox from '../../../base/ui/components/web/Checkbox'; import Checkbox from '../../../base/ui/components/web/Checkbox';
/** /**
* The type of the React {@code Component} props of {@link SoundsTab}. * The type of the React {@code Component} props of {@link SoundsTab}.
*/ */
export type Props = AbstractDialogTabProps & { export type Props = AbstractDialogTabProps & WithTranslation & {
/** /**
* Whether or not the reactions feature is enabled. * Whether or not the reactions feature is enabled.
@ -159,4 +159,5 @@ class SoundsTab extends AbstractDialogTab<Props> {
} }
} }
// @ts-ignore
export default translate(SoundsTab); export default translate(SoundsTab);

View File

@ -1,8 +1,7 @@
/* eslint-disable lines-around-comment */ /* eslint-disable lines-around-comment */
// @ts-ignore // @ts-ignore
import { CAR_MODE_ENABLED, getFeatureFlag } from '../../../base/flags'; import { CAR_MODE_ENABLED, getFeatureFlag } from '../../../base/flags';
// @ts-ignore import { translate } from '../../../base/i18n/functions';
import { translate } from '../../../base/i18n';
import { IconCar } from '../../../base/icons/svg/index'; import { IconCar } from '../../../base/icons/svg/index';
import { connect } from '../../../base/redux/functions'; import { connect } from '../../../base/redux/functions';
// @ts-ignore // @ts-ignore

View File

@ -1,13 +1,13 @@
/* eslint-disable lines-around-comment */ /* eslint-disable lines-around-comment */
import { withStyles } from '@material-ui/styles'; import { withStyles } from '@material-ui/styles';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { WithTranslation } from 'react-i18next';
import { batch, connect } from 'react-redux'; import { batch, connect } from 'react-redux';
// @ts-ignore // @ts-ignore
import ContextMenu from '../../../base/components/context-menu/ContextMenu'; import ContextMenu from '../../../base/components/context-menu/ContextMenu';
// @ts-ignore // @ts-ignore
import ContextMenuItemGroup from '../../../base/components/context-menu/ContextMenuItemGroup'; import ContextMenuItemGroup from '../../../base/components/context-menu/ContextMenuItemGroup';
// @ts-ignore
import { isMobileBrowser } from '../../../base/environment/utils'; import { isMobileBrowser } from '../../../base/environment/utils';
// @ts-ignore // @ts-ignore
import { translate } from '../../../base/i18n'; import { translate } from '../../../base/i18n';
@ -44,7 +44,7 @@ import TogglePinToStageButton from './TogglePinToStageButton';
* The type of the React {@code Component} props of * The type of the React {@code Component} props of
* {@link LocalVideoMenuTriggerButton}. * {@link LocalVideoMenuTriggerButton}.
*/ */
type Props = { interface Props extends WithTranslation {
/** /**
* The id of the local participant. * The id of the local participant.
@ -111,18 +111,13 @@ type Props = {
/** /**
* Shows popover. * Shows popover.
*/ */
showPopover: Function, showPopover: Function
/**
* Invoked to obtain translated strings.
*/
t: Function,
/** /**
* The type of the thumbnail. * The type of the thumbnail.
*/ */
thumbnailType: string thumbnailType: string
}; }
const styles = () => { const styles = () => {
return { return {

View File

@ -1,6 +1,7 @@
/* eslint-disable lines-around-comment */ /* eslint-disable lines-around-comment */
import { withStyles } from '@material-ui/styles'; import { withStyles } from '@material-ui/styles';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { WithTranslation } from 'react-i18next';
import { batch, connect } from 'react-redux'; import { batch, connect } from 'react-redux';
import { isMobileBrowser } from '../../../base/environment/utils'; import { isMobileBrowser } from '../../../base/environment/utils';
@ -34,7 +35,7 @@ declare var $: Object;
* The type of the React {@code Component} props of * The type of the React {@code Component} props of
* {@link RemoteVideoMenuTriggerButton}. * {@link RemoteVideoMenuTriggerButton}.
*/ */
type Props = { interface Props extends WithTranslation {
/** /**
* Whether the remote video context menu is disabled. * Whether the remote video context menu is disabled.
@ -108,16 +109,11 @@ type Props = {
*/ */
showPopover: Function, showPopover: Function,
/**
* Invoked to obtain translated strings.
*/
t: Function,
/** /**
* The type of the thumbnail. * The type of the thumbnail.
*/ */
thumbnailType: string thumbnailType: string
}; }
const styles = () => { const styles = () => {
return { return {