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
43 changed files with 155 additions and 154 deletions

View File

@@ -37,12 +37,12 @@ function checkVersion(ver: string): boolean {
}
function installUpdate(): void {
PlatformPeg.get().installUpdate();
PlatformPeg.get()?.installUpdate();
}
export const showToast = (version: string, newVersion: string, releaseNotes?: string): void => {
function onReject(): void {
PlatformPeg.get().deferUpdate(newVersion);
PlatformPeg.get()?.deferUpdate(newVersion);
}
let onAccept;
@@ -55,7 +55,7 @@ export const showToast = (version: string, newVersion: string, releaseNotes?: st
button: _t("Update"),
onFinished: (update) => {
if (update && PlatformPeg.get()) {
PlatformPeg.get().installUpdate();
PlatformPeg.get()!.installUpdate();
}
},
});
@@ -67,7 +67,7 @@ export const showToast = (version: string, newVersion: string, releaseNotes?: st
newVersion,
onFinished: (update) => {
if (update && PlatformPeg.get()) {
PlatformPeg.get().installUpdate();
PlatformPeg.get()!.installUpdate();
}
},
});