Enable strictPropertyInitialization (#11203)

This commit is contained in:
Michael Telatynski 2023-07-07 14:46:12 +01:00 committed by GitHub
parent 4207d182cd
commit cfd48b36aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 97 additions and 117 deletions

View file

@ -37,7 +37,7 @@ interface IProps {
}
interface IState {
error: Error | null;
error: boolean;
canUploadKeysWithPasswordOnly: boolean | null;
accountPassword: string;
}
@ -52,7 +52,7 @@ export default class CreateCrossSigningDialog extends React.PureComponent<IProps
super(props);
this.state = {
error: null,
error: false,
// Does the server offer a UI auth flow with just m.login.password
// for /keys/device_signing/upload?
// If we have an account password in memory, let's simplify and
@ -145,7 +145,7 @@ export default class CreateCrossSigningDialog extends React.PureComponent<IProps
private bootstrapCrossSigning = async (): Promise<void> => {
this.setState({
error: null,
error: false,
});
try {
@ -161,7 +161,7 @@ export default class CreateCrossSigningDialog extends React.PureComponent<IProps
return;
}
this.setState({ error: e });
this.setState({ error: true });
logger.error("Error bootstrapping cross-signing", e);
}
};

View file

@ -20,6 +20,7 @@ import { MatrixClient } from "matrix-js-sdk/src/client";
import { IKeyBackupInfo, IKeyBackupRestoreResult } from "matrix-js-sdk/src/crypto/keybackup";
import { ISecretStorageKeyInfo } from "matrix-js-sdk/src/crypto/api";
import { logger } from "matrix-js-sdk/src/logger";
import { MatrixError } from "matrix-js-sdk/src/matrix";
import { MatrixClientPeg } from "../../../../MatrixClientPeg";
import { _t } from "../../../../languageHandler";
@ -56,9 +57,7 @@ interface IState {
backupKeyStored: Record<string, ISecretStorageKeyInfo> | null;
loading: boolean;
loadError: boolean | null;
restoreError: {
errcode: string;
} | null;
restoreError: unknown | null;
recoveryKey: string;
recoverInfo: IKeyBackupRestoreResult | null;
recoveryKeyValid: boolean;
@ -343,7 +342,10 @@ export default class RestoreKeyBackupDialog extends React.PureComponent<IProps,
title = _t("Error");
content = _t("Unable to load backup status");
} else if (this.state.restoreError) {
if (this.state.restoreError.errcode === MatrixClient.RESTORE_BACKUP_ERROR_BAD_KEY) {
if (
this.state.restoreError instanceof MatrixError &&
this.state.restoreError.errcode === MatrixClient.RESTORE_BACKUP_ERROR_BAD_KEY
) {
if (this.state.restoreType === RestoreType.RecoveryKey) {
title = _t("Security Key mismatch");
content = (