ref(TS) Improve TS (#13355)

pull/13361/head jitsi-meet_8667
Robert Pintilii 2 years ago committed by GitHub
parent 1af90a208e
commit 59f1ee1e1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      globals.native.d.ts
  2. 6
      react/features/base/color-scheme/ColorSchemeRegistry.ts
  3. 64
      react/features/base/conference/actions.ts
  4. 4
      react/features/base/conference/middleware.any.ts
  5. 1
      react/features/base/lib-jitsi-meet/functions.any.ts
  6. 4
      react/features/base/react/components/web/Watermarks.tsx
  7. 2
      react/features/base/sounds/components/SoundCollection.ts
  8. 2
      react/features/chat/middleware.ts
  9. 3
      react/features/mobile/call-integration/reducer.ts
  10. 5
      react/features/recording/components/Recording/LocalRecordingManager.web.ts
  11. 2
      react/features/room-lock/actions.ts
  12. 1
      react/features/salesforce/actions.ts
  13. 1
      react/features/security/actions.ts
  14. 2
      react/features/shared-video/actions.any.ts
  15. 4
      react/features/videosipgw/middleware.ts

@ -30,6 +30,7 @@ interface IWindow {
setImmediate: typeof setImmediate;
clearImmediate: typeof clearImmediate;
addEventListener: Function;
removeEventListener: Function;
}
interface INavigator {

@ -88,7 +88,7 @@ class ColorSchemeRegistry {
_applyColorScheme(
stateful: IStateful,
componentName: string,
style: StyleType): StyleType {
style: StyleType | null): StyleType {
let schemedStyle: any;
if (Array.isArray(style)) {
@ -115,8 +115,8 @@ class ColorSchemeRegistry {
// The value is another style object, we apply the same
// transformation recursively.
schemedStyle[styleName]
= this._applyColorScheme( // @ts-ignore
stateful, componentName, styleValue);
= this._applyColorScheme(
stateful, componentName, styleValue as StyleType);
} else if (typeof styleValue === 'function') {
// The value is a function, which indicates that it's a
// dynamic, schemed color we need to resolve.

@ -98,34 +98,32 @@ function _addConferenceListeners(conference: IJitsiConference, dispatch: IStore[
JitsiConferenceEvents.AUTH_STATUS_CHANGED,
(authEnabled: boolean, authLogin: string) => dispatch(authStatusChanged(authEnabled, authLogin)));
conference.on(
JitsiConferenceEvents.CONFERENCE_FAILED, // @ts-ignore
(...args: any[]) => dispatch(conferenceFailed(conference, ...args)));
JitsiConferenceEvents.CONFERENCE_FAILED,
(err: string, ...args: any[]) => dispatch(conferenceFailed(conference, err, ...args)));
conference.on(
JitsiConferenceEvents.CONFERENCE_JOINED, // @ts-ignore
(...args: any[]) => dispatch(conferenceJoined(conference, ...args)));
JitsiConferenceEvents.CONFERENCE_JOINED,
(..._args: any[]) => dispatch(conferenceJoined(conference)));
conference.on(
JitsiConferenceEvents.CONFERENCE_UNIQUE_ID_SET, // @ts-ignore
(...args: any[]) => dispatch(conferenceUniqueIdSet(conference, ...args)));
JitsiConferenceEvents.CONFERENCE_UNIQUE_ID_SET,
(..._args: any[]) => dispatch(conferenceUniqueIdSet(conference)));
conference.on(
JitsiConferenceEvents.CONFERENCE_JOIN_IN_PROGRESS, // @ts-ignore
(...args: any[]) => dispatch(conferenceJoinInProgress(conference, ...args)));
JitsiConferenceEvents.CONFERENCE_JOIN_IN_PROGRESS,
(..._args: any[]) => dispatch(conferenceJoinInProgress(conference)));
conference.on(
JitsiConferenceEvents.CONFERENCE_LEFT,
(...args: any[]) => {
(..._args: any[]) => {
dispatch(conferenceTimestampChanged(0));
// @ts-ignore
dispatch(conferenceLeft(conference, ...args));
dispatch(conferenceLeft(conference));
});
conference.on(JitsiConferenceEvents.SUBJECT_CHANGED, // @ts-ignore
(...args: any[]) => dispatch(conferenceSubjectChanged(...args)));
conference.on(JitsiConferenceEvents.SUBJECT_CHANGED,
(subject: string) => dispatch(conferenceSubjectChanged(subject)));
conference.on(JitsiConferenceEvents.CONFERENCE_CREATED_TIMESTAMP, // @ts-ignore
(...args: any[]) => dispatch(conferenceTimestampChanged(...args)));
conference.on(JitsiConferenceEvents.CONFERENCE_CREATED_TIMESTAMP,
(timestamp: number) => dispatch(conferenceTimestampChanged(timestamp)));
conference.on(
JitsiConferenceEvents.KICKED, // @ts-ignore
(...args: any[]) => dispatch(kickedOut(conference, ...args)));
JitsiConferenceEvents.KICKED,
(participant: any) => dispatch(kickedOut(conference, participant)));
conference.on(
JitsiConferenceEvents.PARTICIPANT_KICKED,
@ -136,8 +134,8 @@ function _addConferenceListeners(conference: IJitsiConference, dispatch: IStore[
(jitsiParticipant: IJitsiParticipant) => dispatch(participantSourcesUpdated(jitsiParticipant)));
conference.on(
JitsiConferenceEvents.LOCK_STATE_CHANGED, // @ts-ignore
(...args: any[]) => dispatch(lockStateChanged(conference, ...args)));
JitsiConferenceEvents.LOCK_STATE_CHANGED,
(locked: boolean) => dispatch(lockStateChanged(conference, locked)));
// Dispatches into features/base/media follow:
@ -220,12 +218,12 @@ function _addConferenceListeners(conference: IJitsiConference, dispatch: IStore[
});
conference.on(
JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, // @ts-ignore
(...args: any[]) => dispatch(endpointMessageReceived(...args)));
JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
(participant: Object, json: Object) => dispatch(endpointMessageReceived(participant, json)));
conference.on(
JitsiConferenceEvents.NON_PARTICIPANT_MESSAGE_RECEIVED, // @ts-ignore
(...args: any[]) => dispatch(nonParticipantMessageReceived(...args)));
JitsiConferenceEvents.NON_PARTICIPANT_MESSAGE_RECEIVED,
(id: string, json: Object) => dispatch(nonParticipantMessageReceived(id, json)));
conference.on(
JitsiConferenceEvents.USER_JOINED,
@ -234,15 +232,15 @@ function _addConferenceListeners(conference: IJitsiConference, dispatch: IStore[
JitsiConferenceEvents.USER_LEFT,
(_id: string, user: any) => commonUserLeftHandling({ dispatch }, conference, user));
conference.on(
JitsiConferenceEvents.USER_ROLE_CHANGED, // @ts-ignore
(...args: any[]) => dispatch(participantRoleChanged(...args)));
JitsiConferenceEvents.USER_ROLE_CHANGED,
(id: string, role: string) => dispatch(participantRoleChanged(id, role)));
conference.on(
JitsiConferenceEvents.USER_STATUS_CHANGED, // @ts-ignore
(...args: any[]) => dispatch(participantPresenceChanged(...args)));
JitsiConferenceEvents.USER_STATUS_CHANGED,
(id: string, presence: string) => dispatch(participantPresenceChanged(id, presence)));
conference.on(
JitsiE2ePingEvents.E2E_RTT_CHANGED, // @ts-ignore
(...args: any[]) => dispatch(e2eRttChanged(...args)));
JitsiE2ePingEvents.E2E_RTT_CHANGED,
(participant: Object, rtt: number) => dispatch(e2eRttChanged(participant, rtt)));
conference.on(
JitsiConferenceEvents.BOT_TYPE_CHANGED,
@ -633,7 +631,7 @@ export function endConference() {
* participant: JitsiParticipant
* }}
*/
export function kickedOut(conference: Object, participant: Object) {
export function kickedOut(conference: IJitsiConference, participant: Object) {
return {
type: KICKED_OUT,
conference,
@ -673,7 +671,7 @@ export function leaveConference() {
* locked: boolean
* }}
*/
export function lockStateChanged(conference: Object, locked: boolean) {
export function lockStateChanged(conference: IJitsiConference, locked: boolean) {
return {
type: LOCK_STATE_CHANGED,
conference,
@ -692,7 +690,7 @@ export function lockStateChanged(conference: Object, locked: boolean) {
* json: Object
* }}
*/
export function nonParticipantMessageReceived(id: String, json: Object) {
export function nonParticipantMessageReceived(id: string, json: Object) {
return {
type: NON_PARTICIPANT_MESSAGE_RECEIVED,
id,

@ -67,7 +67,7 @@ import logger from './logger';
/**
* Handler for before unload event.
*/
let beforeUnloadHandler: Function | undefined;
let beforeUnloadHandler: (() => void) | undefined;
/**
* Implements the middleware of the feature base/conference.
@ -295,7 +295,6 @@ function _conferenceJoined({ dispatch, getState }: IStore, next: Function, actio
dispatch(overwriteConfig({ disableFocus: false }));
}
// @ts-ignore
window.addEventListener(disableBeforeUnloadHandlers ? 'unload' : 'beforeunload', beforeUnloadHandler);
if (requireDisplayName
@ -513,7 +512,6 @@ function _removeUnloadHandler(getState: IStore['getState']) {
if (typeof beforeUnloadHandler !== 'undefined') {
const { disableBeforeUnloadHandlers = false } = getState()['features/base/config'];
// @ts-ignore
window.removeEventListener(disableBeforeUnloadHandlers ? 'unload' : 'beforeunload', beforeUnloadHandler);
beforeUnloadHandler = undefined;
}

@ -2,7 +2,6 @@ import { IStateful } from '../app/types';
import { ConnectionFailedError } from '../connection/actions.any';
import { toState } from '../redux/functions';
// @ts-ignore
import JitsiMeetJS from './_';

@ -168,10 +168,10 @@ class Watermarks extends Component<IProps, State> {
maxWidth: 140,
maxHeight: 70,
position: _logoLink ? 'static' : 'absolute'
};
} as const;
reactElement = (<div
className = { className } // @ts-ignore
className = { className }
style = { style } />);
if (_logoLink) {

@ -57,7 +57,7 @@ class SoundCollection extends Component<IProps> {
sounds.push(
React.createElement(
Audio, {
key, // @ts-ignore
key,
setRef: this._setRef.bind(this, soundId),
src,
loop: options?.loop

@ -35,8 +35,6 @@ import { showToolbox } from '../toolbox/actions';
import { ADD_MESSAGE, CLOSE_CHAT, OPEN_CHAT, SEND_MESSAGE, SET_IS_POLL_TAB_FOCUSED } from './actionTypes';
import { addMessage, clearMessages, closeChat } from './actions.any';
// eslint-disable-next-line lines-around-comment
// @ts-ignore
import { ChatPrivacyDialog } from './components';
import {
INCOMING_MSG_SOUND_ID,

@ -1,10 +1,7 @@
import ReducerRegistry from '../../base/redux/ReducerRegistry';
import { set } from '../../base/redux/functions';
// @ts-ignore
import CallKit from './CallKit';
// eslint-disable-next-line lines-around-comment
// @ts-ignore
import ConnectionService from './ConnectionService';
import { _SET_CALL_INTEGRATION_SUBSCRIPTIONS } from './actionTypes';

@ -138,9 +138,7 @@ const LocalRecordingManager: ILocalRecordingManager = {
async saveRecording(recordingData, filename) {
// @ts-ignore
const blob = await fixWebmDuration(new Blob(recordingData, { type: this.mediaType }));
// @ts-ignore
const url = window.URL.createObjectURL(blob);
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
const extension = this.mediaType.slice(this.mediaType.indexOf('/') + 1, this.mediaType.indexOf(';'));
@ -249,7 +247,6 @@ const LocalRecordingManager: ILocalRecordingManager = {
});
document.title = currentTitle;
// @ts-ignore
const isBrowser = gdmStream.getVideoTracks()[0].getSettings().displaySurface === 'browser';
if (!isBrowser || (supportsCaptureHandle // @ts-ignore

@ -7,8 +7,6 @@ import { conferenceLeft, setPassword } from '../base/conference/actions';
import { JITSI_CONFERENCE_URL_KEY } from '../base/conference/constants';
import { IJitsiConference } from '../base/conference/reducer';
import { hideDialog, openDialog } from '../base/dialog/actions';
// eslint-disable-next-line lines-around-comment
// @ts-ignore
import { SecurityDialog } from '../security/components/security-dialog';
import PasswordRequiredPrompt from './components/PasswordRequiredPrompt';

@ -7,7 +7,6 @@ import {
SALESFORCE_LINK_NOTIFICATION_ID
} from '../notifications/constants';
// @ts-ignore
import { SalesforceLinkDialog } from './components';
import { isSalesforceEnabled } from './functions';

@ -1,7 +1,6 @@
import { IStore } from '../app/types';
import { toggleDialog } from '../base/dialog/actions';
// @ts-ignore
import { SecurityDialog } from './components/security-dialog';
/**

@ -4,8 +4,6 @@ import { openDialog } from '../base/dialog/actions';
import { getLocalParticipant } from '../base/participants/functions';
import { RESET_SHARED_VIDEO_STATUS, SET_SHARED_VIDEO_STATUS } from './actionTypes';
// eslint-disable-next-line lines-around-comment
// @ts-ignore
import { SharedVideoDialog } from './components';
/**

@ -39,9 +39,7 @@ MiddlewareRegistry.register(({ dispatch }) => next => action => {
conference.on(
JitsiConferenceEvents.VIDEO_SIP_GW_AVAILABILITY_CHANGED,
// @ts-ignore
(...args) => dispatch(_availabilityChanged(...args)));
(status: string) => dispatch(_availabilityChanged(status)));
conference.on(
JitsiConferenceEvents.VIDEO_SIP_GW_SESSION_STATE_CHANGED,
(event: ISipSessionChangedEvent) => {

Loading…
Cancel
Save