Conform more code to strict null checking (#10167)
* Conform more code to strict null checking * Delint * Iterate PR based on feedback
This commit is contained in:
parent
f7bea2cae5
commit
4574c665ea
103 changed files with 517 additions and 495 deletions
|
@ -19,6 +19,7 @@ import { logger } from "matrix-js-sdk/src/logger";
|
|||
|
||||
import SdkConfig from "../SdkConfig";
|
||||
import { MatrixClientPeg } from "../MatrixClientPeg";
|
||||
import { Policies } from "../Terms";
|
||||
|
||||
export function getDefaultIdentityServerUrl(): string {
|
||||
return SdkConfig.get("validated_server_config").isUrl;
|
||||
|
@ -33,7 +34,7 @@ export function setToDefaultIdentityServer(): void {
|
|||
}
|
||||
|
||||
export async function doesIdentityServerHaveTerms(fullUrl: string): Promise<boolean> {
|
||||
let terms;
|
||||
let terms: { policies?: Policies } | null;
|
||||
try {
|
||||
terms = await MatrixClientPeg.get().getTerms(SERVICE_TYPES.IS, fullUrl);
|
||||
} catch (e) {
|
||||
|
@ -45,7 +46,7 @@ export async function doesIdentityServerHaveTerms(fullUrl: string): Promise<bool
|
|||
}
|
||||
}
|
||||
|
||||
return terms && terms["policies"] && Object.keys(terms["policies"]).length > 0;
|
||||
return !!terms?.["policies"] && Object.keys(terms["policies"]).length > 0;
|
||||
}
|
||||
|
||||
export function doesAccountDataHaveIdentityServer(): boolean {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue