Conform more of the codebase to strictNullChecks (#11134)
This commit is contained in:
parent
3d886de5b0
commit
e1cad41bc3
15 changed files with 44 additions and 36 deletions
|
@ -261,7 +261,15 @@ export default class AutoDiscoveryUtils {
|
|||
throw new UserFriendlyError("Unexpected error resolving homeserver configuration");
|
||||
}
|
||||
|
||||
let delegatedAuthentication = undefined;
|
||||
let delegatedAuthentication:
|
||||
| {
|
||||
authorizationEndpoint: string;
|
||||
registrationEndpoint?: string;
|
||||
tokenEndpoint: string;
|
||||
account?: string;
|
||||
issuer: string;
|
||||
}
|
||||
| undefined;
|
||||
if (discoveryResult[M_AUTHENTICATION.stable!]?.state === AutoDiscovery.SUCCESS) {
|
||||
const { authorizationEndpoint, registrationEndpoint, tokenEndpoint, account, issuer } = discoveryResult[
|
||||
M_AUTHENTICATION.stable!
|
||||
|
|
|
@ -60,7 +60,7 @@ export async function decryptFile(file?: IEncryptedFile, info?: IMediaEventInfo)
|
|||
}
|
||||
responseData = await response.arrayBuffer();
|
||||
} catch (e) {
|
||||
throw new DownloadError(e);
|
||||
throw new DownloadError(e as Error);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -77,6 +77,6 @@ export async function decryptFile(file?: IEncryptedFile, info?: IMediaEventInfo)
|
|||
|
||||
return new Blob([dataArray], { type: mimetype });
|
||||
} catch (e) {
|
||||
throw new DecryptError(e);
|
||||
throw new DecryptError(e as Error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ function log(msg: string): void {
|
|||
logger.log(`StorageManager: ${msg}`);
|
||||
}
|
||||
|
||||
function error(msg: string, ...args: string[]): void {
|
||||
function error(msg: string, ...args: any[]): void {
|
||||
logger.error(`StorageManager: ${msg}`, ...args);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,14 +33,14 @@ export async function retry<T, E extends Error>(
|
|||
num: number,
|
||||
predicate?: (e: E) => boolean,
|
||||
): Promise<T> {
|
||||
let lastErr!: E;
|
||||
let lastErr!: any;
|
||||
for (let i = 0; i < num; i++) {
|
||||
try {
|
||||
const v = await fn();
|
||||
// If `await fn()` throws then we won't reach here
|
||||
return v;
|
||||
} catch (err) {
|
||||
if (predicate && !predicate(err)) {
|
||||
if (predicate && !predicate(err as E)) {
|
||||
throw err;
|
||||
}
|
||||
lastErr = err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue