Переглянути джерело

ref(TS Convert some files to TS (#12191)

factor2
Robert Pintilii 2 роки тому
джерело
коміт
6dd04136de
Аккаунт користувача з таким Email не знайдено

+ 2
- 1
.eslintrc.js Переглянути файл

@@ -1,5 +1,6 @@
1 1
 module.exports = {
2 2
     'extends': [
3 3
         '@jitsi/eslint-config'
4
-    ]
4
+    ],
5
+    'ignorePatterns': [ '*.d.ts' ]
5 6
 };

+ 6
- 0
globals.d.ts Переглянути файл

@@ -0,0 +1,6 @@
1
+export {};
2
+
3
+declare global {
4
+    const APP: any;
5
+    const interfaceConfig: any;
6
+}

react/features/base/conference/functions.js → react/features/base/conference/functions.ts Переглянути файл

@@ -1,25 +1,24 @@
1
-// @flow
2
-
3 1
 import { sha512_256 as sha512 } from 'js-sha512';
4 2
 import _ from 'lodash';
5 3
 
4
+// @ts-ignore
6 5
 import { getName } from '../../app/functions';
6
+import { IState, IStore } from '../../app/types';
7 7
 import { determineTranscriptionLanguage } from '../../transcribing/functions';
8
+import { IStateful } from '../app/types';
8 9
 import { JitsiTrackErrors } from '../lib-jitsi-meet';
9 10
 import {
10
-    getLocalParticipant,
11 11
     hiddenParticipantJoined,
12 12
     hiddenParticipantLeft,
13 13
     participantJoined,
14 14
     participantLeft
15
-} from '../participants';
16
-import { toState } from '../redux';
17
-import {
18
-    getBackendSafePath,
19
-    getJitsiMeetGlobalNS,
20
-    safeDecodeURIComponent
21
-} from '../util';
15
+} from '../participants/actions';
16
+import { getLocalParticipant } from '../participants/functions';
17
+import { toState } from '../redux/functions';
18
+import { getJitsiMeetGlobalNS } from '../util/helpers';
19
+import { getBackendSafePath, safeDecodeURIComponent } from '../util/uri';
22 20
 
21
+// @ts-ignore
23 22
 import { setObfuscatedRoom } from './actions';
24 23
 import {
25 24
     AVATAR_URL_COMMAND,
@@ -27,22 +26,23 @@ import {
27 26
     JITSI_CONFERENCE_URL_KEY
28 27
 } from './constants';
29 28
 import logger from './logger';
29
+import { IJitsiConference } from './reducer';
30 30
 
31 31
 /**
32 32
  * Returns root conference state.
33 33
  *
34
- * @param {Object} state - Global state.
34
+ * @param {IState} state - Global state.
35 35
  * @returns {Object} Conference state.
36 36
  */
37
-export const getConferenceState = (state: Object) => state['features/base/conference'];
37
+export const getConferenceState = (state: IState) => state['features/base/conference'];
38 38
 
39 39
 /**
40 40
  * Is the conference joined or not.
41 41
  *
42
- * @param {Object} state - Global state.
42
+ * @param {IState} state - Global state.
43 43
  * @returns {boolean}
44 44
  */
45
-export const getIsConferenceJoined = (state: Object) => Boolean(getConferenceState(state).conference);
45
+export const getIsConferenceJoined = (state: IState) => Boolean(getConferenceState(state).conference);
46 46
 
47 47
 /**
48 48
  * Attach a set of local tracks to a conference.
@@ -53,7 +53,7 @@ export const getIsConferenceJoined = (state: Object) => Boolean(getConferenceSta
53 53
  * @returns {Promise}
54 54
  */
55 55
 export function _addLocalTracksToConference(
56
-        conference: { addTrack: Function, getLocalTracks: Function },
56
+        conference: IJitsiConference,
57 57
         localTracks: Array<Object>) {
58 58
     const conferenceLocalTracks = conference.getLocalTracks();
59 59
     const promises = [];
@@ -63,7 +63,7 @@ export function _addLocalTracksToConference(
63 63
         // adding one and the same video track multiple times.
64 64
         if (conferenceLocalTracks.indexOf(track) === -1) {
65 65
             promises.push(
66
-                conference.addTrack(track).catch(err => {
66
+                conference.addTrack(track).catch((err: Error) => {
67 67
                     _reportError(
68 68
                         'Failed to add local track to conference',
69 69
                         err);
@@ -86,16 +86,16 @@ export function _addLocalTracksToConference(
86 86
  * @returns {void}
87 87
  */
88 88
 export function commonUserJoinedHandling(
89
-        { dispatch }: Object,
90
-        conference: Object,
91
-        user: Object) {
89
+        { dispatch }: IStore,
90
+        conference: IJitsiConference,
91
+        user: any) {
92 92
     const id = user.getId();
93 93
     const displayName = user.getDisplayName();
94 94
 
95 95
     if (user.isHidden()) {
96 96
         dispatch(hiddenParticipantJoined(id, displayName));
97 97
     } else {
98
-        const isReplacing = user.isReplacing && user.isReplacing();
98
+        const isReplacing = user?.isReplacing();
99 99
 
100 100
         dispatch(participantJoined({
101 101
             botType: user.getBotType(),
@@ -122,15 +122,15 @@ export function commonUserJoinedHandling(
122 122
  * @returns {void}
123 123
  */
124 124
 export function commonUserLeftHandling(
125
-        { dispatch }: Object,
126
-        conference: Object,
127
-        user: Object) {
125
+        { dispatch }: IStore,
126
+        conference: IJitsiConference,
127
+        user: any) {
128 128
     const id = user.getId();
129 129
 
130 130
     if (user.isHidden()) {
131 131
         dispatch(hiddenParticipantLeft(id));
132 132
     } else {
133
-        const isReplaced = user.isReplaced && user.isReplaced();
133
+        const isReplaced = user.isReplaced?.();
134 134
 
135 135
         dispatch(participantLeft(id, conference, { isReplaced }));
136 136
     }
@@ -140,7 +140,7 @@ export function commonUserLeftHandling(
140 140
  * Evaluates a specific predicate for each {@link JitsiConference} known to the
141 141
  * redux state features/base/conference while it returns {@code true}.
142 142
  *
143
- * @param {Function | Object} stateful - The redux store, state, or
143
+ * @param {IStateful} stateful - The redux store, state, or
144 144
  * {@code getState} function.
145 145
  * @param {Function} predicate - The predicate to evaluate for each
146 146
  * {@code JitsiConference} know to the redux state features/base/conference
@@ -150,8 +150,8 @@ export function commonUserLeftHandling(
150 150
  * features/base/conference.
151 151
  */
152 152
 export function forEachConference(
153
-        stateful: Function | Object,
154
-        predicate: (Object, URL) => boolean) {
153
+        stateful: IStateful,
154
+        predicate: (a: any, b: URL) => boolean) {
155 155
     const state = getConferenceState(toState(stateful));
156 156
 
157 157
     for (const v of Object.values(state)) {
@@ -178,48 +178,48 @@ export function forEachConference(
178 178
 /**
179 179
  * Returns the display name of the conference.
180 180
  *
181
- * @param {Function | Object} stateful - Reference that can be resolved to Redux
181
+ * @param {IStateful} stateful - Reference that can be resolved to Redux
182 182
  * state with the {@code toState} function.
183 183
  * @returns {string}
184 184
  */
185
-export function getConferenceName(stateful: Function | Object): string {
185
+export function getConferenceName(stateful: IStateful): string {
186 186
     const state = toState(stateful);
187 187
     const { callee } = state['features/base/jwt'];
188 188
     const { callDisplayName } = state['features/base/config'];
189 189
     const { localSubject, room, subject } = getConferenceState(state);
190 190
 
191
-    return localSubject
191
+    return (localSubject
192 192
         || subject
193 193
         || callDisplayName
194
-        || (callee && callee.name)
195
-        || (room && safeStartCase(safeDecodeURIComponent(room)));
194
+        || callee?.name
195
+        || (room && safeStartCase(safeDecodeURIComponent(room)))) ?? '';
196 196
 }
197 197
 
198 198
 /**
199 199
  * Returns the name of the conference formatted for the title.
200 200
  *
201
- * @param {Function | Object} stateful - Reference that can be resolved to Redux state with the {@code toState}
201
+ * @param {IStateful} stateful - Reference that can be resolved to Redux state with the {@code toState}
202 202
  * function.
203 203
  * @returns {string} - The name of the conference formatted for the title.
204 204
  */
205
-export function getConferenceNameForTitle(stateful: Function | Object) {
206
-    return safeStartCase(safeDecodeURIComponent(getConferenceState(toState(stateful)).room));
205
+export function getConferenceNameForTitle(stateful: IStateful) {
206
+    return safeStartCase(safeDecodeURIComponent(getConferenceState(toState(stateful)).room ?? ''));
207 207
 }
208 208
 
209 209
 /**
210 210
  * Returns an object aggregating the conference options.
211 211
  *
212
- * @param {Object|Function} stateful - The redux store state.
212
+ * @param {IStateful} stateful - The redux store state.
213 213
  * @returns {Object} - Options object.
214 214
  */
215
-export function getConferenceOptions(stateful: Function | Object) {
215
+export function getConferenceOptions(stateful: IStateful) {
216 216
     const state = toState(stateful);
217 217
 
218 218
     const config = state['features/base/config'];
219 219
     const { locationURL } = state['features/base/connection'];
220 220
     const { tenant } = state['features/base/jwt'];
221
-    const { email, name: nick } = getLocalParticipant(state);
222
-    const options = { ...config };
221
+    const { email, name: nick } = getLocalParticipant(state) ?? {};
222
+    const options: any = { ...config };
223 223
 
224 224
     if (tenant) {
225 225
         options.siteID = tenant;
@@ -257,11 +257,11 @@ export function getConferenceOptions(stateful: Function | Object) {
257 257
 /**
258 258
 * Returns the UTC timestamp when the first participant joined the conference.
259 259
 *
260
-* @param {Function | Object} stateful - Reference that can be resolved to Redux
260
+* @param {IStateful} stateful - Reference that can be resolved to Redux
261 261
 * state with the {@code toState} function.
262 262
 * @returns {number}
263 263
 */
264
-export function getConferenceTimestamp(stateful: Function | Object): number {
264
+export function getConferenceTimestamp(stateful: IStateful) {
265 265
     const state = toState(stateful);
266 266
     const { conferenceTimestamp } = getConferenceState(state);
267 267
 
@@ -274,11 +274,11 @@ export function getConferenceTimestamp(stateful: Function | Object): number {
274 274
  * {@code conference} state of the feature base/conference which is not joining
275 275
  * but may be leaving already.
276 276
  *
277
- * @param {Function|Object} stateful - The redux store, state, or
277
+ * @param {IStateful} stateful - The redux store, state, or
278 278
  * {@code getState} function.
279 279
  * @returns {JitsiConference|undefined}
280 280
  */
281
-export function getCurrentConference(stateful: Function | Object) {
281
+export function getCurrentConference(stateful: IStateful): any {
282 282
     const { conference, joining, leaving, membersOnly, passwordRequired }
283 283
         = getConferenceState(toState(stateful));
284 284
 
@@ -293,25 +293,29 @@ export function getCurrentConference(stateful: Function | Object) {
293 293
 /**
294 294
  * Returns the stored room name.
295 295
  *
296
- * @param {Object} state - The current state of the app.
296
+ * @param {IState} state - The current state of the app.
297 297
  * @returns {string}
298 298
  */
299
-export function getRoomName(state: Object): string {
299
+export function getRoomName(state: IState) {
300 300
     return getConferenceState(state).room;
301 301
 }
302 302
 
303 303
 /**
304 304
  * Get an obfuscated room name or create and persist it if it doesn't exists.
305 305
  *
306
- * @param {Object} state - The current state of the app.
306
+ * @param {IState} state - The current state of the app.
307 307
  * @param {Function} dispatch - The Redux dispatch function.
308 308
  * @returns {string} - Obfuscated room name.
309 309
  */
310
-export function getOrCreateObfuscatedRoomName(state: Object, dispatch: Function) {
310
+export function getOrCreateObfuscatedRoomName(state: IState, dispatch: IStore['dispatch']) {
311 311
     let { obfuscatedRoom } = getConferenceState(state);
312 312
     const { obfuscatedRoomSource } = getConferenceState(state);
313 313
     const room = getRoomName(state);
314 314
 
315
+    if (!room) {
316
+        return;
317
+    }
318
+
315 319
     // On native mobile the store doesn't clear when joining a new conference so we might have the obfuscatedRoom
316 320
     // stored even though a different room was joined.
317 321
     // Check if the obfuscatedRoom was already computed for the current room.
@@ -327,11 +331,11 @@ export function getOrCreateObfuscatedRoomName(state: Object, dispatch: Function)
327 331
  * Analytics may require an obfuscated room name, this functions decides based on a config if the normal or
328 332
  * obfuscated room name should be returned.
329 333
  *
330
- * @param {Object} state - The current state of the app.
334
+ * @param {IState} state - The current state of the app.
331 335
  * @param {Function} dispatch - The Redux dispatch function.
332 336
  * @returns {string} - Analytics room name.
333 337
  */
334
-export function getAnalyticsRoomName(state: Object, dispatch: Function) {
338
+export function getAnalyticsRoomName(state: IState, dispatch: IStore['dispatch']) {
335 339
     const { analysis: { obfuscateRoomName = false } = {} } = state['features/base/config'];
336 340
 
337 341
     if (obfuscateRoomName) {
@@ -365,7 +369,7 @@ function getWiFiStatsMethod() {
365 369
  * @protected
366 370
  * @returns {void}
367 371
  */
368
-export function _handleParticipantError(err: { message: ?string }) {
372
+export function _handleParticipantError(err: Error) {
369 373
     // XXX DataChannels are initialized at some later point when the conference
370 374
     // has multiple participants, but code that pins or selects a participant
371 375
     // might be executed before. So here we're swallowing a particular error.
@@ -384,7 +388,7 @@ export function _handleParticipantError(err: { message: ?string }) {
384 388
  * @returns {boolean} If the specified room name is valid, then true; otherwise,
385 389
  * false.
386 390
  */
387
-export function isRoomValid(room: ?string) {
391
+export function isRoomValid(room?: string) {
388 392
     return typeof room === 'string' && room !== '';
389 393
 }
390 394
 
@@ -397,11 +401,11 @@ export function isRoomValid(room: ?string) {
397 401
  * @returns {Promise}
398 402
  */
399 403
 export function _removeLocalTracksFromConference(
400
-        conference: { removeTrack: Function },
404
+        conference: IJitsiConference,
401 405
         localTracks: Array<Object>) {
402 406
     return Promise.all(localTracks.map(track =>
403 407
         conference.removeTrack(track)
404
-            .catch(err => {
408
+            .catch((err: Error) => {
405 409
                 // Local track might be already disposed by direct
406 410
                 // JitsiTrack#dispose() call. So we should ignore this error
407 411
                 // here.
@@ -425,7 +429,7 @@ export function _removeLocalTracksFromConference(
425 429
  * @private
426 430
  * @returns {void}
427 431
  */
428
-function _reportError(msg, err) {
432
+function _reportError(msg: string, err: Error) {
429 433
     // TODO This is a good point to call some global error handler when we have
430 434
     // one.
431 435
     logger.error(msg, err);
@@ -443,17 +447,14 @@ function _reportError(msg, err) {
443 447
  * @returns {void}
444 448
  */
445 449
 export function sendLocalParticipant(
446
-        stateful: Function | Object,
447
-        conference: {
448
-            sendCommand: Function,
449
-            setDisplayName: Function,
450
-            setLocalParticipantProperty: Function }) {
450
+        stateful: IStateful,
451
+        conference: IJitsiConference) {
451 452
     const {
452 453
         avatarURL,
453 454
         email,
454 455
         features,
455 456
         name
456
-    } = getLocalParticipant(stateful);
457
+    } = getLocalParticipant(stateful) ?? {};
457 458
 
458 459
     avatarURL && conference.sendCommand(AVATAR_URL_COMMAND, {
459 460
         value: avatarURL

react/features/base/conference/logger.js → react/features/base/conference/logger.ts Переглянути файл

@@ -1,5 +1,3 @@
1
-// @flow
2
-
3 1
 import { getLogger } from '../logging/functions';
4 2
 
5 3
 export default getLogger('features/base/conference');

+ 16
- 1
react/features/base/conference/reducer.ts Переглянути файл

@@ -40,11 +40,26 @@ const DEFAULT_STATE = {
40 40
     passwordRequired: undefined
41 41
 };
42 42
 
43
+export interface IJitsiConference {
44
+    addTrack: Function;
45
+    getBreakoutRooms: Function;
46
+    getLocalTracks: Function;
47
+    isAVModerationSupported: Function;
48
+    isEndConferenceSupported: Function;
49
+    isLobbySupported: Function;
50
+    removeTrack: Function;
51
+    sendCommand: Function;
52
+    sendEndpointMessage: Function;
53
+    sessionId: string;
54
+    setDisplayName: Function;
55
+    setLocalParticipantProperty: Function;
56
+}
57
+
43 58
 export interface IConferenceState {
44 59
     authEnabled?: boolean;
45 60
     authLogin?: string;
46 61
     authRequired?: Object;
47
-    conference?: any;
62
+    conference?: IJitsiConference;
48 63
     conferenceTimestamp?: number;
49 64
     e2eeSupported?: boolean;
50 65
     error?: Error;

+ 1
- 0
react/features/base/config/configType.ts Переглянути файл

@@ -125,6 +125,7 @@ export interface IConfig {
125 125
         key: ButtonsWithNotifyClick;
126 126
         preventExecution: boolean;
127 127
     }>;
128
+    callDisplayName?: string;
128 129
     callStatsConfigParams?: {
129 130
         additionalIDs?: {
130 131
             customerID?: string;

+ 4
- 0
react/features/base/config/reducer.ts Переглянути файл

@@ -71,7 +71,11 @@ const CONFERENCE_HEADER_MAPPING: any = {
71 71
 };
72 72
 
73 73
 export interface IConfigState extends IConfig {
74
+    analysis?: {
75
+        obfuscateRoomName?: boolean;
76
+    };
74 77
     error?: Error;
78
+    firefox_fake_device?: string;
75 79
 }
76 80
 
77 81
 ReducerRegistry.register<IConfigState>('features/base/config', (state = _getInitialState(), action): IConfigState => {

+ 4
- 0
react/features/base/jwt/reducer.ts Переглянути файл

@@ -4,9 +4,13 @@ import { equals } from '../redux/functions';
4 4
 import { SET_JWT } from './actionTypes';
5 5
 
6 6
 export interface IJwtState {
7
+    callee?: {
8
+        name: string;
9
+    };
7 10
     group?: string;
8 11
     jwt?: string;
9 12
     server?: string;
13
+    tenant?: string;
10 14
 }
11 15
 
12 16
 /**

react/features/base/media/actions.js → react/features/base/media/actions.ts Переглянути файл

@@ -1,10 +1,8 @@
1
-/* @flow */
2
-
3
-import type { Dispatch } from 'redux';
1
+import { Dispatch } from 'redux';
4 2
 
5 3
 import { showModeratedNotification } from '../../av-moderation/actions';
6 4
 import { shouldShowModeratedNotification } from '../../av-moderation/functions';
7
-import { isModerationNotificationDisplayed } from '../../notifications';
5
+import { isModerationNotificationDisplayed } from '../../notifications/functions';
8 6
 
9 7
 import {
10 8
     SET_AUDIO_MUTED,
@@ -55,7 +53,7 @@ export function setAudioAvailable(available: boolean) {
55 53
  *     muted: boolean
56 54
  * }}
57 55
  */
58
-export function setAudioMuted(muted: boolean, ensureTrack: boolean = false) {
56
+export function setAudioMuted(muted: boolean, ensureTrack = false) {
59 57
     return {
60 58
         type: SET_AUDIO_MUTED,
61 59
         ensureTrack,
@@ -70,7 +68,7 @@ export function setAudioMuted(muted: boolean, ensureTrack: boolean = false) {
70 68
  * @param {boolean|undefined} skipNotification - True if we want to skip showing the notification.
71 69
  * @returns {Function}
72 70
  */
73
-export function setAudioUnmutePermissions(blocked: boolean, skipNotification: boolean = false) {
71
+export function setAudioUnmutePermissions(blocked: boolean, skipNotification = false) {
74 72
     return {
75 73
         type: SET_AUDIO_UNMUTE_PERMISSIONS,
76 74
         blocked,
@@ -107,7 +105,7 @@ export function setScreenshareMuted(
107 105
         muted: boolean,
108 106
         mediaType: MediaType = MEDIA_TYPE.SCREENSHARE,
109 107
         authority: number = SCREENSHARE_MUTISM_AUTHORITY.USER,
110
-        ensureTrack: boolean = false) {
108
+        ensureTrack = false) {
111 109
     return (dispatch: Dispatch<any>, getState: Function) => {
112 110
         const state = getState();
113 111
 
@@ -168,7 +166,7 @@ export function setVideoMuted(
168 166
         muted: boolean,
169 167
         mediaType: string = MEDIA_TYPE.VIDEO,
170 168
         authority: number = VIDEO_MUTISM_AUTHORITY.USER,
171
-        ensureTrack: boolean = false) {
169
+        ensureTrack = false) {
172 170
     return (dispatch: Dispatch<any>, getState: Function) => {
173 171
         const state = getState();
174 172
 
@@ -203,7 +201,7 @@ export function setVideoMuted(
203 201
  * @param {boolean|undefined} skipNotification - True if we want to skip showing the notification.
204 202
  * @returns {Function}
205 203
  */
206
-export function setVideoUnmutePermissions(blocked: boolean, skipNotification: boolean = false) {
204
+export function setVideoUnmutePermissions(blocked: boolean, skipNotification = false) {
207 205
     return {
208 206
         type: SET_VIDEO_UNMUTE_PERMISSIONS,
209 207
         blocked,

+ 1
- 1
react/features/base/participants/types.ts Переглянути файл

@@ -8,7 +8,7 @@ export interface Participant {
8 8
     e2eeSupported?: boolean;
9 9
     email?: string;
10 10
     features?: {
11
-        'screen-sharing'?: boolean;
11
+        'screen-sharing'?: boolean | string;
12 12
     };
13 13
     getId?: Function;
14 14
     id: string;

react/features/base/testing/actions.js → react/features/base/testing/actions.ts Переглянути файл


react/features/base/testing/functions.js → react/features/base/testing/functions.ts Переглянути файл

@@ -1,8 +1,9 @@
1
-// @flow
2
-
3
-import { getMultipleVideoSupportFeatureFlag } from '../config';
4
-import { MEDIA_TYPE, VIDEO_TYPE } from '../media';
5
-import { getParticipantById } from '../participants';
1
+import { IState, IStore } from '../../app/types';
2
+import { getMultipleVideoSupportFeatureFlag } from '../config/functions.any';
3
+import { MEDIA_TYPE, VIDEO_TYPE } from '../media/constants';
4
+import { getParticipantById } from '../participants/functions';
5
+// eslint-disable-next-line lines-around-comment
6
+// @ts-ignore
6 7
 import { getTrackByMediaTypeAndParticipant, getVirtualScreenshareParticipantTrack } from '../tracks';
7 8
 
8 9
 /**
@@ -10,23 +11,23 @@ import { getTrackByMediaTypeAndParticipant, getVirtualScreenshareParticipantTrac
10 11
  * {@link TestHint} and other components from the testing package will be
11 12
  * rendered in various places across the app to help with automatic testing.
12 13
  *
13
- * @param {Object} state - The redux store state.
14
+ * @param {IState} state - The redux store state.
14 15
  * @returns {boolean}
15 16
  */
16
-export function isTestModeEnabled(state: Object): boolean {
17
+export function isTestModeEnabled(state: IState): boolean {
17 18
     const testingConfig = state['features/base/config'].testing;
18 19
 
19
-    return Boolean(testingConfig && testingConfig.testMode);
20
+    return Boolean(testingConfig?.testMode);
20 21
 }
21 22
 
22 23
 /**
23 24
  * Returns the video type of the remote participant's video.
24 25
  *
25
- * @param {Store} store - The redux store.
26
+ * @param {IStore} store - The redux store.
26 27
  * @param {string} id - The participant ID for the remote video.
27 28
  * @returns {VIDEO_TYPE}
28 29
  */
29
-export function getRemoteVideoType({ getState }: Object, id: String): VIDEO_TYPE {
30
+export function getRemoteVideoType({ getState }: IStore, id: string) {
30 31
     const state = getState();
31 32
     const participant = getParticipantById(state, id);
32 33
 
@@ -40,13 +41,13 @@ export function getRemoteVideoType({ getState }: Object, id: String): VIDEO_TYPE
40 41
 /**
41 42
  * Returns whether the last media event received for large video indicates that the video is playing, if not muted.
42 43
  *
43
- * @param {Store} store - The redux store.
44
+ * @param {IStore} store - The redux store.
44 45
  * @returns {boolean}
45 46
  */
46
-export function isLargeVideoReceived({ getState }: Object): boolean {
47
+export function isLargeVideoReceived({ getState }: IStore): boolean {
47 48
     const state = getState();
48 49
     const largeVideoParticipantId = state['features/large-video'].participantId;
49
-    const largeVideoParticipant = getParticipantById(state, largeVideoParticipantId);
50
+    const largeVideoParticipant = getParticipantById(state, largeVideoParticipantId ?? '');
50 51
     const tracks = state['features/base/tracks'];
51 52
     let videoTrack;
52 53
 
@@ -64,11 +65,11 @@ export function isLargeVideoReceived({ getState }: Object): boolean {
64 65
 /**
65 66
  * Returns whether the last media event received for a remote video indicates that the video is playing, if not muted.
66 67
  *
67
- * @param {Store} store - The redux store.
68
+ * @param {IStore} store - The redux store.
68 69
  * @param {string} id - The participant ID for the remote video.
69 70
  * @returns {boolean}
70 71
  */
71
-export function isRemoteVideoReceived({ getState }: Object, id: String): boolean {
72
+export function isRemoteVideoReceived({ getState }: IStore, id: string): boolean {
72 73
     const state = getState();
73 74
     const tracks = state['features/base/tracks'];
74 75
     const participant = getParticipantById(state, id);

+ 1
- 1
react/features/face-landmarks/functions.ts Переглянути файл

@@ -111,7 +111,7 @@ export async function sendFaceExpressionsWebhook(state: IState) {
111 111
 
112 112
     const reqBody = {
113 113
         meetingFqn: extractFqnFromPath(),
114
-        sessionId: conference.sessionId,
114
+        sessionId: conference?.sessionId,
115 115
         submitted: Date.now(),
116 116
         emotions: faceExpressionsBuffer,
117 117
         participantId: localParticipant?.jwtId,

react/features/notifications/functions.js → react/features/notifications/functions.ts Переглянути файл

@@ -1,19 +1,16 @@
1
-// @flow
2
-
3 1
 import { MODERATION_NOTIFICATIONS } from '../av-moderation/constants';
4
-import { MEDIA_TYPE } from '../base/media';
5
-import { toState } from '../base/redux';
6
-
7
-declare var interfaceConfig: Object;
2
+import { IStateful } from '../base/app/types';
3
+import { MediaType } from '../base/media/constants';
4
+import { toState } from '../base/redux/functions';
8 5
 
9 6
 /**
10 7
  * Tells whether or not the notifications are enabled and if there are any
11 8
  * notifications to be displayed based on the current Redux state.
12 9
  *
13
- * @param {Object|Function} stateful - The redux store state.
10
+ * @param {IStateful} stateful - The redux store state.
14 11
  * @returns {boolean}
15 12
  */
16
-export function areThereNotifications(stateful: Object | Function) {
13
+export function areThereNotifications(stateful: IStateful) {
17 14
     const state = toState(stateful);
18 15
     const { enabled, notifications } = state['features/notifications'];
19 16
 
@@ -33,10 +30,10 @@ export function joinLeaveNotificationsDisabled() {
33 30
  * Returns whether or not the moderation notification for the given type is displayed.
34 31
  *
35 32
  * @param {MEDIA_TYPE} mediaType - The media type to check.
36
- * @param {Object | Function} stateful - The redux store state.
33
+ * @param {IStateful} stateful - The redux store state.
37 34
  * @returns {boolean}
38 35
  */
39
-export function isModerationNotificationDisplayed(mediaType: MEDIA_TYPE, stateful: Object | Function) {
36
+export function isModerationNotificationDisplayed(mediaType: MediaType, stateful: IStateful) {
40 37
     const state = toState(stateful);
41 38
 
42 39
     const { notifications } = state['features/notifications'];

+ 1
- 1
react/features/prejoin/components/Prejoin.native.tsx Переглянути файл

@@ -65,7 +65,7 @@ const Prejoin: React.FC<PrejoinProps> = ({ navigation }: PrejoinProps) => {
65 65
     );
66 66
     const localParticipant = useSelector((state: IState) => getLocalParticipant(state));
67 67
     const isDisplayNameMandatory = useSelector(state => isDisplayNameRequired(state));
68
-    const roomName = useSelector(state => getConferenceName(state));
68
+    const roomName = useSelector((state: IState) => getConferenceName(state));
69 69
     const participantName = localParticipant?.name;
70 70
     const [ displayName, setDisplayName ]
71 71
         = useState(participantName || '');

+ 1
- 1
react/features/reactions/functions.any.ts Переглянути файл

@@ -69,7 +69,7 @@ export async function sendReactionsWebhook(state: IState, reactions: Array<strin
69 69
 
70 70
     const reqBody = {
71 71
         meetingFqn: extractFqnFromPath(),
72
-        sessionId: conference.sessionId,
72
+        sessionId: conference?.sessionId,
73 73
         submitted: Date.now(),
74 74
         reactions,
75 75
         participantId: localParticipant?.jwtId,

react/features/transcribing/functions.js → react/features/transcribing/functions.ts Переглянути файл

@@ -1,7 +1,7 @@
1
-// @flow
2
-
3 1
 import i18next from 'i18next';
4 2
 
3
+import { IConfig } from '../base/config/configType';
4
+
5 5
 import JITSI_TO_BCP47_MAP from './jitsi-bcp47-map.json';
6 6
 import logger from './logger';
7 7
 import TRANSCRIBER_LANGS from './transcriber-langs.json';
@@ -14,7 +14,7 @@ const DEFAULT_TRANSCRIBER_LANG = 'en-US';
14 14
  * @param {*} config - Application config.
15 15
  * @returns {string}
16 16
  */
17
-export function determineTranscriptionLanguage(config: Object) {
17
+export function determineTranscriptionLanguage(config: IConfig) {
18 18
     const { transcription } = config;
19 19
 
20 20
     // if transcriptions are not enabled nothing to determine
@@ -27,11 +27,11 @@ export function determineTranscriptionLanguage(config: Object) {
27 27
     // Jitsi language detections uses custom language tags, but the transcriber expects BCP-47 compliant tags,
28 28
     // we use a mapping file to convert them.
29 29
     const bcp47Locale = transcription?.useAppLanguage ?? true
30
-        ? JITSI_TO_BCP47_MAP[i18next.language]
30
+        ? JITSI_TO_BCP47_MAP[i18next.language as keyof typeof JITSI_TO_BCP47_MAP]
31 31
         : transcription?.preferredLanguage;
32 32
 
33 33
     // Check if the obtained language is supported by the transcriber
34
-    let safeBCP47Locale = TRANSCRIBER_LANGS[bcp47Locale] && bcp47Locale;
34
+    let safeBCP47Locale = TRANSCRIBER_LANGS[bcp47Locale as keyof typeof TRANSCRIBER_LANGS] && bcp47Locale;
35 35
 
36 36
     if (!safeBCP47Locale) {
37 37
         safeBCP47Locale = DEFAULT_TRANSCRIBER_LANG;

react/features/transcribing/logger.js → react/features/transcribing/logger.ts Переглянути файл

@@ -1,5 +1,3 @@
1
-// @flow
2
-
3 1
 import { getLogger } from '../base/logging/functions';
4 2
 
5 3
 export default getLogger('features/transcribing');

+ 1
- 1
tsconfig.json Переглянути файл

@@ -1,5 +1,5 @@
1 1
 {
2
-    "include": ["react/features/**/*.ts", "react/features/**/*.tsx", "./custom.d.ts"],
2
+    "include": ["react/features/**/*.ts", "react/features/**/*.tsx", "./custom.d.ts", "./globals.d.ts"],
3 3
     "compilerOptions": {
4 4
         "allowSyntheticDefaultImports": true,
5 5
         "module": "es6",

Завантаження…
Відмінити
Зберегти