Enhance typing of channels and sync-box

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne SavolainenandMikko Aspiala committed 2022-06-03 07:48:01 +03:00
1 parent ec7c806dc0
commit b78b7887ab
15 files changed
+52 -29

No files matched your search

@@ -4,6 +4,7 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import createSyncBoxInjectable from "../../sync-box/create-sync-box.injectable";
import type { UpdateChannel } from "../../../main/update-app/update-channels";
const discoveredUpdateVersionInjectable = getInjectable({
id: "discovered-update-version",
@@ -11,7 +12,9 @@ const discoveredUpdateVersionInjectable = getInjectable({
instantiate: (di) => {
const createSyncBox = di.inject(createSyncBoxInjectable);
return createSyncBox("discovered-update-version");
return createSyncBox<{ version: string; updateChannel: UpdateChannel }>(
"discovered-update-version",
);
},
});
@@ -11,7 +11,7 @@ const progressOfUpdateDownloadInjectable = getInjectable({
instantiate: (di) => {
const createSyncBox = di.inject(createSyncBoxInjectable);
return createSyncBox("progress-of-update-download");
return createSyncBox<number>("progress-of-update-download");
},
});
@@ -11,7 +11,7 @@ const updateIsBeingDownloadedInjectable = getInjectable({
instantiate: (di) => {
const createSyncBox = di.inject(createSyncBoxInjectable);
return createSyncBox("update-is-being-downloaded");
return createSyncBox<boolean>("update-is-being-downloaded");
},
});
@@ -11,7 +11,7 @@ const updatesAreBeingDiscoveredInjectable = getInjectable({
instantiate: (di) => {
const createSyncBox = di.inject(createSyncBoxInjectable);
return createSyncBox("updates-are-being-discovered");
return createSyncBox<boolean>("updates-are-being-discovered");
},
});