Conform more of the codebase to strictNullChecks (#10731)

This commit is contained in:
Michael Telatynski 2023-04-28 09:45:36 +01:00 committed by GitHub
parent 9f8113eabd
commit 1281c0746b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 147 additions and 119 deletions

View file

@ -123,7 +123,7 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> {
this.getUpdatedDiagnostics();
try {
const backupInfo = await MatrixClientPeg.get().getKeyBackupVersion();
const backupSigStatus = await MatrixClientPeg.get().isKeyBackupTrusted(backupInfo);
const backupSigStatus = await MatrixClientPeg.get().isKeyBackupTrusted(backupInfo!);
if (this.unmounted) return;
this.setState({
loading: false,
@ -285,7 +285,7 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> {
);
}
let backupSigStatuses: React.ReactNode = backupSigStatus.sigs.map((sig, i) => {
let backupSigStatuses: React.ReactNode = backupSigStatus?.sigs.map((sig, i) => {
const deviceName = sig.device ? sig.device.getDisplayName() || sig.device.deviceId : null;
const validity = (sub: string): JSX.Element => (
<span className={sig.valid ? "mx_SecureBackupPanel_sigValid" : "mx_SecureBackupPanel_sigInvalid"}>

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import { MatrixClient } from "matrix-js-sdk/src/matrix";
import { IAuthData } from "matrix-js-sdk/src/interactive-auth";
import { IAuthDict, IAuthData } from "matrix-js-sdk/src/interactive-auth";
import { _t } from "../../../../languageHandler";
import Modal from "../../../../Modal";
@ -25,8 +25,8 @@ import InteractiveAuthDialog from "../../dialogs/InteractiveAuthDialog";
const makeDeleteRequest =
(matrixClient: MatrixClient, deviceIds: string[]) =>
async (auth?: IAuthData): Promise<IAuthData> => {
return matrixClient.deleteMultipleDevices(deviceIds, auth);
async (auth: IAuthDict | null): Promise<IAuthData> => {
return matrixClient.deleteMultipleDevices(deviceIds, auth ?? undefined);
};
export const deleteDevicesWithInteractiveAuth = async (
@ -38,7 +38,7 @@ export const deleteDevicesWithInteractiveAuth = async (
return;
}
try {
await makeDeleteRequest(matrixClient, deviceIds)();
await makeDeleteRequest(matrixClient, deviceIds)(null);
// no interactive auth needed
onFinished(true, undefined);
} catch (error) {

View file

@ -161,7 +161,7 @@ const SessionManagerTab: React.FC = () => {
const shouldShowOtherSessions = otherSessionsCount > 0;
const onVerifyCurrentDevice = (): void => {
Modal.createDialog(SetupEncryptionDialog as unknown as React.ComponentType, { onFinished: refreshDevices });
Modal.createDialog(SetupEncryptionDialog, { onFinished: refreshDevices });
};
const onTriggerDeviceVerification = useCallback(