浏览代码

ref(TS) Improve TS (#13355)

factor2
Robert Pintilii 2 年前
父节点
当前提交
59f1ee1e1e
没有帐户链接到提交者的电子邮件

+ 1
- 0
globals.native.d.ts 查看文件

30
     setImmediate: typeof setImmediate;
30
     setImmediate: typeof setImmediate;
31
     clearImmediate: typeof clearImmediate;
31
     clearImmediate: typeof clearImmediate;
32
     addEventListener: Function;
32
     addEventListener: Function;
33
+    removeEventListener: Function;
33
 }
34
 }
34
 
35
 
35
 interface INavigator {
36
 interface INavigator {

+ 3
- 3
react/features/base/color-scheme/ColorSchemeRegistry.ts 查看文件

88
     _applyColorScheme(
88
     _applyColorScheme(
89
             stateful: IStateful,
89
             stateful: IStateful,
90
             componentName: string,
90
             componentName: string,
91
-            style: StyleType): StyleType {
91
+            style: StyleType | null): StyleType {
92
         let schemedStyle: any;
92
         let schemedStyle: any;
93
 
93
 
94
         if (Array.isArray(style)) {
94
         if (Array.isArray(style)) {
115
                     // The value is another style object, we apply the same
115
                     // The value is another style object, we apply the same
116
                     // transformation recursively.
116
                     // transformation recursively.
117
                     schemedStyle[styleName]
117
                     schemedStyle[styleName]
118
-                        = this._applyColorScheme( // @ts-ignore
119
-                            stateful, componentName, styleValue);
118
+                        = this._applyColorScheme(
119
+                            stateful, componentName, styleValue as StyleType);
120
                 } else if (typeof styleValue === 'function') {
120
                 } else if (typeof styleValue === 'function') {
121
                     // The value is a function, which indicates that it's a
121
                     // The value is a function, which indicates that it's a
122
                     // dynamic, schemed color we need to resolve.
122
                     // dynamic, schemed color we need to resolve.

+ 31
- 33
react/features/base/conference/actions.ts 查看文件

98
         JitsiConferenceEvents.AUTH_STATUS_CHANGED,
98
         JitsiConferenceEvents.AUTH_STATUS_CHANGED,
99
         (authEnabled: boolean, authLogin: string) => dispatch(authStatusChanged(authEnabled, authLogin)));
99
         (authEnabled: boolean, authLogin: string) => dispatch(authStatusChanged(authEnabled, authLogin)));
100
     conference.on(
100
     conference.on(
101
-        JitsiConferenceEvents.CONFERENCE_FAILED, // @ts-ignore
102
-        (...args: any[]) => dispatch(conferenceFailed(conference, ...args)));
101
+        JitsiConferenceEvents.CONFERENCE_FAILED,
102
+        (err: string, ...args: any[]) => dispatch(conferenceFailed(conference, err, ...args)));
103
     conference.on(
103
     conference.on(
104
-        JitsiConferenceEvents.CONFERENCE_JOINED, // @ts-ignore
105
-        (...args: any[]) => dispatch(conferenceJoined(conference, ...args)));
104
+        JitsiConferenceEvents.CONFERENCE_JOINED,
105
+        (..._args: any[]) => dispatch(conferenceJoined(conference)));
106
     conference.on(
106
     conference.on(
107
-        JitsiConferenceEvents.CONFERENCE_UNIQUE_ID_SET, // @ts-ignore
108
-        (...args: any[]) => dispatch(conferenceUniqueIdSet(conference, ...args)));
107
+        JitsiConferenceEvents.CONFERENCE_UNIQUE_ID_SET,
108
+        (..._args: any[]) => dispatch(conferenceUniqueIdSet(conference)));
109
     conference.on(
109
     conference.on(
110
-        JitsiConferenceEvents.CONFERENCE_JOIN_IN_PROGRESS, // @ts-ignore
111
-        (...args: any[]) => dispatch(conferenceJoinInProgress(conference, ...args)));
110
+        JitsiConferenceEvents.CONFERENCE_JOIN_IN_PROGRESS,
111
+        (..._args: any[]) => dispatch(conferenceJoinInProgress(conference)));
112
     conference.on(
112
     conference.on(
113
         JitsiConferenceEvents.CONFERENCE_LEFT,
113
         JitsiConferenceEvents.CONFERENCE_LEFT,
114
-        (...args: any[]) => {
114
+        (..._args: any[]) => {
115
             dispatch(conferenceTimestampChanged(0));
115
             dispatch(conferenceTimestampChanged(0));
116
-
117
-            // @ts-ignore
118
-            dispatch(conferenceLeft(conference, ...args));
116
+            dispatch(conferenceLeft(conference));
119
         });
117
         });
120
-    conference.on(JitsiConferenceEvents.SUBJECT_CHANGED, // @ts-ignore
121
-        (...args: any[]) => dispatch(conferenceSubjectChanged(...args)));
118
+    conference.on(JitsiConferenceEvents.SUBJECT_CHANGED,
119
+        (subject: string) => dispatch(conferenceSubjectChanged(subject)));
122
 
120
 
123
-    conference.on(JitsiConferenceEvents.CONFERENCE_CREATED_TIMESTAMP, // @ts-ignore
124
-        (...args: any[]) => dispatch(conferenceTimestampChanged(...args)));
121
+    conference.on(JitsiConferenceEvents.CONFERENCE_CREATED_TIMESTAMP,
122
+        (timestamp: number) => dispatch(conferenceTimestampChanged(timestamp)));
125
 
123
 
126
     conference.on(
124
     conference.on(
127
-        JitsiConferenceEvents.KICKED, // @ts-ignore
128
-        (...args: any[]) => dispatch(kickedOut(conference, ...args)));
125
+        JitsiConferenceEvents.KICKED,
126
+        (participant: any) => dispatch(kickedOut(conference, participant)));
129
 
127
 
130
     conference.on(
128
     conference.on(
131
         JitsiConferenceEvents.PARTICIPANT_KICKED,
129
         JitsiConferenceEvents.PARTICIPANT_KICKED,
136
         (jitsiParticipant: IJitsiParticipant) => dispatch(participantSourcesUpdated(jitsiParticipant)));
134
         (jitsiParticipant: IJitsiParticipant) => dispatch(participantSourcesUpdated(jitsiParticipant)));
137
 
135
 
138
     conference.on(
136
     conference.on(
139
-        JitsiConferenceEvents.LOCK_STATE_CHANGED, // @ts-ignore
140
-        (...args: any[]) => dispatch(lockStateChanged(conference, ...args)));
137
+        JitsiConferenceEvents.LOCK_STATE_CHANGED,
138
+        (locked: boolean) => dispatch(lockStateChanged(conference, locked)));
141
 
139
 
142
     // Dispatches into features/base/media follow:
140
     // Dispatches into features/base/media follow:
143
 
141
 
220
         });
218
         });
221
 
219
 
222
     conference.on(
220
     conference.on(
223
-        JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, // @ts-ignore
224
-        (...args: any[]) => dispatch(endpointMessageReceived(...args)));
221
+        JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
222
+        (participant: Object, json: Object) => dispatch(endpointMessageReceived(participant, json)));
225
 
223
 
226
     conference.on(
224
     conference.on(
227
-        JitsiConferenceEvents.NON_PARTICIPANT_MESSAGE_RECEIVED, // @ts-ignore
228
-        (...args: any[]) => dispatch(nonParticipantMessageReceived(...args)));
225
+        JitsiConferenceEvents.NON_PARTICIPANT_MESSAGE_RECEIVED,
226
+        (id: string, json: Object) => dispatch(nonParticipantMessageReceived(id, json)));
229
 
227
 
230
     conference.on(
228
     conference.on(
231
         JitsiConferenceEvents.USER_JOINED,
229
         JitsiConferenceEvents.USER_JOINED,
234
         JitsiConferenceEvents.USER_LEFT,
232
         JitsiConferenceEvents.USER_LEFT,
235
         (_id: string, user: any) => commonUserLeftHandling({ dispatch }, conference, user));
233
         (_id: string, user: any) => commonUserLeftHandling({ dispatch }, conference, user));
236
     conference.on(
234
     conference.on(
237
-        JitsiConferenceEvents.USER_ROLE_CHANGED, // @ts-ignore
238
-        (...args: any[]) => dispatch(participantRoleChanged(...args)));
235
+        JitsiConferenceEvents.USER_ROLE_CHANGED,
236
+        (id: string, role: string) => dispatch(participantRoleChanged(id, role)));
239
     conference.on(
237
     conference.on(
240
-        JitsiConferenceEvents.USER_STATUS_CHANGED, // @ts-ignore
241
-        (...args: any[]) => dispatch(participantPresenceChanged(...args)));
238
+        JitsiConferenceEvents.USER_STATUS_CHANGED,
239
+        (id: string, presence: string) => dispatch(participantPresenceChanged(id, presence)));
242
 
240
 
243
     conference.on(
241
     conference.on(
244
-        JitsiE2ePingEvents.E2E_RTT_CHANGED, // @ts-ignore
245
-        (...args: any[]) => dispatch(e2eRttChanged(...args)));
242
+        JitsiE2ePingEvents.E2E_RTT_CHANGED,
243
+        (participant: Object, rtt: number) => dispatch(e2eRttChanged(participant, rtt)));
246
 
244
 
247
     conference.on(
245
     conference.on(
248
         JitsiConferenceEvents.BOT_TYPE_CHANGED,
246
         JitsiConferenceEvents.BOT_TYPE_CHANGED,
633
  *     participant: JitsiParticipant
631
  *     participant: JitsiParticipant
634
  * }}
632
  * }}
635
  */
633
  */
636
-export function kickedOut(conference: Object, participant: Object) {
634
+export function kickedOut(conference: IJitsiConference, participant: Object) {
637
     return {
635
     return {
638
         type: KICKED_OUT,
636
         type: KICKED_OUT,
639
         conference,
637
         conference,
673
  *     locked: boolean
671
  *     locked: boolean
674
  * }}
672
  * }}
675
  */
673
  */
676
-export function lockStateChanged(conference: Object, locked: boolean) {
674
+export function lockStateChanged(conference: IJitsiConference, locked: boolean) {
677
     return {
675
     return {
678
         type: LOCK_STATE_CHANGED,
676
         type: LOCK_STATE_CHANGED,
679
         conference,
677
         conference,
692
  *      json: Object
690
  *      json: Object
693
  * }}
691
  * }}
694
  */
692
  */
695
-export function nonParticipantMessageReceived(id: String, json: Object) {
693
+export function nonParticipantMessageReceived(id: string, json: Object) {
696
     return {
694
     return {
697
         type: NON_PARTICIPANT_MESSAGE_RECEIVED,
695
         type: NON_PARTICIPANT_MESSAGE_RECEIVED,
698
         id,
696
         id,

+ 1
- 3
react/features/base/conference/middleware.any.ts 查看文件

67
 /**
67
 /**
68
  * Handler for before unload event.
68
  * Handler for before unload event.
69
  */
69
  */
70
-let beforeUnloadHandler: Function | undefined;
70
+let beforeUnloadHandler: (() => void) | undefined;
71
 
71
 
72
 /**
72
 /**
73
  * Implements the middleware of the feature base/conference.
73
  * Implements the middleware of the feature base/conference.
295
         dispatch(overwriteConfig({ disableFocus: false }));
295
         dispatch(overwriteConfig({ disableFocus: false }));
296
     }
296
     }
297
 
297
 
298
-    // @ts-ignore
299
     window.addEventListener(disableBeforeUnloadHandlers ? 'unload' : 'beforeunload', beforeUnloadHandler);
298
     window.addEventListener(disableBeforeUnloadHandlers ? 'unload' : 'beforeunload', beforeUnloadHandler);
300
 
299
 
301
     if (requireDisplayName
300
     if (requireDisplayName
513
     if (typeof beforeUnloadHandler !== 'undefined') {
512
     if (typeof beforeUnloadHandler !== 'undefined') {
514
         const { disableBeforeUnloadHandlers = false } = getState()['features/base/config'];
513
         const { disableBeforeUnloadHandlers = false } = getState()['features/base/config'];
515
 
514
 
516
-        // @ts-ignore
517
         window.removeEventListener(disableBeforeUnloadHandlers ? 'unload' : 'beforeunload', beforeUnloadHandler);
515
         window.removeEventListener(disableBeforeUnloadHandlers ? 'unload' : 'beforeunload', beforeUnloadHandler);
518
         beforeUnloadHandler = undefined;
516
         beforeUnloadHandler = undefined;
519
     }
517
     }

+ 0
- 1
react/features/base/lib-jitsi-meet/functions.any.ts 查看文件

2
 import { ConnectionFailedError } from '../connection/actions.any';
2
 import { ConnectionFailedError } from '../connection/actions.any';
3
 import { toState } from '../redux/functions';
3
 import { toState } from '../redux/functions';
4
 
4
 
5
-// @ts-ignore
6
 import JitsiMeetJS from './_';
5
 import JitsiMeetJS from './_';
7
 
6
 
8
 
7
 

+ 2
- 2
react/features/base/react/components/web/Watermarks.tsx 查看文件

168
                 maxWidth: 140,
168
                 maxWidth: 140,
169
                 maxHeight: 70,
169
                 maxHeight: 70,
170
                 position: _logoLink ? 'static' : 'absolute'
170
                 position: _logoLink ? 'static' : 'absolute'
171
-            };
171
+            } as const;
172
 
172
 
173
             reactElement = (<div
173
             reactElement = (<div
174
-                className = { className } // @ts-ignore
174
+                className = { className }
175
                 style = { style } />);
175
                 style = { style } />);
176
 
176
 
177
             if (_logoLink) {
177
             if (_logoLink) {

+ 1
- 1
react/features/base/sounds/components/SoundCollection.ts 查看文件

57
             sounds.push(
57
             sounds.push(
58
                 React.createElement(
58
                 React.createElement(
59
                     Audio, {
59
                     Audio, {
60
-                        key, // @ts-ignore
60
+                        key,
61
                         setRef: this._setRef.bind(this, soundId),
61
                         setRef: this._setRef.bind(this, soundId),
62
                         src,
62
                         src,
63
                         loop: options?.loop
63
                         loop: options?.loop

+ 0
- 2
react/features/chat/middleware.ts 查看文件

35
 
35
 
36
 import { ADD_MESSAGE, CLOSE_CHAT, OPEN_CHAT, SEND_MESSAGE, SET_IS_POLL_TAB_FOCUSED } from './actionTypes';
36
 import { ADD_MESSAGE, CLOSE_CHAT, OPEN_CHAT, SEND_MESSAGE, SET_IS_POLL_TAB_FOCUSED } from './actionTypes';
37
 import { addMessage, clearMessages, closeChat } from './actions.any';
37
 import { addMessage, clearMessages, closeChat } from './actions.any';
38
-// eslint-disable-next-line lines-around-comment
39
-// @ts-ignore
40
 import { ChatPrivacyDialog } from './components';
38
 import { ChatPrivacyDialog } from './components';
41
 import {
39
 import {
42
     INCOMING_MSG_SOUND_ID,
40
     INCOMING_MSG_SOUND_ID,

+ 0
- 3
react/features/mobile/call-integration/reducer.ts 查看文件

1
 import ReducerRegistry from '../../base/redux/ReducerRegistry';
1
 import ReducerRegistry from '../../base/redux/ReducerRegistry';
2
 import { set } from '../../base/redux/functions';
2
 import { set } from '../../base/redux/functions';
3
 
3
 
4
-// @ts-ignore
5
 import CallKit from './CallKit';
4
 import CallKit from './CallKit';
6
-// eslint-disable-next-line lines-around-comment
7
-// @ts-ignore
8
 import ConnectionService from './ConnectionService';
5
 import ConnectionService from './ConnectionService';
9
 import { _SET_CALL_INTEGRATION_SUBSCRIPTIONS } from './actionTypes';
6
 import { _SET_CALL_INTEGRATION_SUBSCRIPTIONS } from './actionTypes';
10
 
7
 

+ 1
- 4
react/features/recording/components/Recording/LocalRecordingManager.web.ts 查看文件

138
     async saveRecording(recordingData, filename) {
138
     async saveRecording(recordingData, filename) {
139
         // @ts-ignore
139
         // @ts-ignore
140
         const blob = await fixWebmDuration(new Blob(recordingData, { type: this.mediaType }));
140
         const blob = await fixWebmDuration(new Blob(recordingData, { type: this.mediaType }));
141
-
142
-        // @ts-ignore
143
-        const url = window.URL.createObjectURL(blob);
141
+        const url = URL.createObjectURL(blob);
144
         const a = document.createElement('a');
142
         const a = document.createElement('a');
145
 
143
 
146
         const extension = this.mediaType.slice(this.mediaType.indexOf('/') + 1, this.mediaType.indexOf(';'));
144
         const extension = this.mediaType.slice(this.mediaType.indexOf('/') + 1, this.mediaType.indexOf(';'));
249
             });
247
             });
250
             document.title = currentTitle;
248
             document.title = currentTitle;
251
 
249
 
252
-            // @ts-ignore
253
             const isBrowser = gdmStream.getVideoTracks()[0].getSettings().displaySurface === 'browser';
250
             const isBrowser = gdmStream.getVideoTracks()[0].getSettings().displaySurface === 'browser';
254
 
251
 
255
             if (!isBrowser || (supportsCaptureHandle // @ts-ignore
252
             if (!isBrowser || (supportsCaptureHandle // @ts-ignore

+ 0
- 2
react/features/room-lock/actions.ts 查看文件

7
 import { JITSI_CONFERENCE_URL_KEY } from '../base/conference/constants';
7
 import { JITSI_CONFERENCE_URL_KEY } from '../base/conference/constants';
8
 import { IJitsiConference } from '../base/conference/reducer';
8
 import { IJitsiConference } from '../base/conference/reducer';
9
 import { hideDialog, openDialog } from '../base/dialog/actions';
9
 import { hideDialog, openDialog } from '../base/dialog/actions';
10
-// eslint-disable-next-line lines-around-comment
11
-// @ts-ignore
12
 import { SecurityDialog } from '../security/components/security-dialog';
10
 import { SecurityDialog } from '../security/components/security-dialog';
13
 
11
 
14
 import PasswordRequiredPrompt from './components/PasswordRequiredPrompt';
12
 import PasswordRequiredPrompt from './components/PasswordRequiredPrompt';

+ 0
- 1
react/features/salesforce/actions.ts 查看文件

7
     SALESFORCE_LINK_NOTIFICATION_ID
7
     SALESFORCE_LINK_NOTIFICATION_ID
8
 } from '../notifications/constants';
8
 } from '../notifications/constants';
9
 
9
 
10
-// @ts-ignore
11
 import { SalesforceLinkDialog } from './components';
10
 import { SalesforceLinkDialog } from './components';
12
 import { isSalesforceEnabled } from './functions';
11
 import { isSalesforceEnabled } from './functions';
13
 
12
 

+ 0
- 1
react/features/security/actions.ts 查看文件

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

+ 0
- 2
react/features/shared-video/actions.any.ts 查看文件

4
 import { getLocalParticipant } from '../base/participants/functions';
4
 import { getLocalParticipant } from '../base/participants/functions';
5
 
5
 
6
 import { RESET_SHARED_VIDEO_STATUS, SET_SHARED_VIDEO_STATUS } from './actionTypes';
6
 import { RESET_SHARED_VIDEO_STATUS, SET_SHARED_VIDEO_STATUS } from './actionTypes';
7
-// eslint-disable-next-line lines-around-comment
8
-// @ts-ignore
9
 import { SharedVideoDialog } from './components';
7
 import { SharedVideoDialog } from './components';
10
 
8
 
11
 /**
9
 /**

+ 1
- 3
react/features/videosipgw/middleware.ts 查看文件

39
 
39
 
40
         conference.on(
40
         conference.on(
41
             JitsiConferenceEvents.VIDEO_SIP_GW_AVAILABILITY_CHANGED,
41
             JitsiConferenceEvents.VIDEO_SIP_GW_AVAILABILITY_CHANGED,
42
-
43
-            // @ts-ignore
44
-            (...args) => dispatch(_availabilityChanged(...args)));
42
+            (status: string) => dispatch(_availabilityChanged(status)));
45
         conference.on(
43
         conference.on(
46
             JitsiConferenceEvents.VIDEO_SIP_GW_SESSION_STATE_CHANGED,
44
             JitsiConferenceEvents.VIDEO_SIP_GW_SESSION_STATE_CHANGED,
47
             (event: ISipSessionChangedEvent) => {
45
             (event: ISipSessionChangedEvent) => {

正在加载...
取消
保存