Conform more code to strict null checking (#10169)

* Conform more code to strict null checking

* delint

* Iterate

* delint

* Fix bad test
This commit is contained in:
Michael Telatynski 2023-02-16 09:38:44 +00:00 committed by GitHub
parent 5123d7e641
commit e8b92b308b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
85 changed files with 283 additions and 287 deletions

View file

@ -27,7 +27,7 @@ import AccessibleButton from "../../../components/views/elements/AccessibleButto
import { CheckUpdatesPayload } from "../../../dispatcher/payloads/CheckUpdatesPayload";
function installUpdate(): void {
PlatformPeg.get().installUpdate();
PlatformPeg.get()?.installUpdate();
}
function getStatusText(status: UpdateCheckStatus, errorDetail?: string): ReactNode {
@ -58,11 +58,11 @@ function getStatusText(status: UpdateCheckStatus, errorDetail?: string): ReactNo
const doneStatuses = [UpdateCheckStatus.Ready, UpdateCheckStatus.Error, UpdateCheckStatus.NotAvailable];
const UpdateCheckButton: React.FC = () => {
const [state, setState] = useState<CheckUpdatesPayload>(null);
const [state, setState] = useState<CheckUpdatesPayload | null>(null);
const onCheckForUpdateClick = (): void => {
setState(null);
PlatformPeg.get().startUpdateCheck();
PlatformPeg.get()?.startUpdateCheck();
};
useDispatcher(dis, ({ action, ...params }) => {
@ -71,9 +71,9 @@ const UpdateCheckButton: React.FC = () => {
}
});
const busy = state && !doneStatuses.includes(state.status);
const busy = !!state && !doneStatuses.includes(state.status);
let suffix;
let suffix: JSX.Element | undefined;
if (state) {
suffix = (
<span className="mx_UpdateCheckButton_summary">