Improve typescript null checking in places (#10073 (#10073

* Improve typescript null checking in places

* Iterate

* Fix Timer.ts
This commit is contained in:
Michael Telatynski 2023-02-03 15:27:47 +00:00 committed by GitHub
parent 97506cbcdb
commit 9743852380
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 155 additions and 154 deletions

View file

@ -648,7 +648,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
onFinished: (confirm) => {
if (confirm) {
// FIXME: controller shouldn't be loading a view :(
const modal = Modal.createDialog(Spinner, null, "mx_Dialog_spinner");
const modal = Modal.createDialog(Spinner, undefined, "mx_Dialog_spinner");
MatrixClientPeg.get()
.leave(payload.room_id)

View file

@ -72,7 +72,7 @@ export default class MKeyVerificationConclusion extends React.Component<IProps>
this.forceUpdate();
};
public static shouldRender(mxEvent: MatrixEvent, request: VerificationRequest): boolean {
public static shouldRender(mxEvent: MatrixEvent, request?: VerificationRequest): boolean {
// normally should not happen
if (!request) {
return false;
@ -99,9 +99,9 @@ export default class MKeyVerificationConclusion extends React.Component<IProps>
return true;
}
public render(): JSX.Element {
public render(): JSX.Element | null {
const { mxEvent } = this.props;
const request = mxEvent.verificationRequest;
const request = mxEvent.verificationRequest!;
if (!MKeyVerificationConclusion.shouldRender(mxEvent, request)) {
return null;
@ -110,7 +110,7 @@ export default class MKeyVerificationConclusion extends React.Component<IProps>
const client = MatrixClientPeg.get();
const myUserId = client.getUserId();
let title;
let title: string | undefined;
if (request.done) {
title = _t("You verified %(name)s", {