fix: type import (#2715)

(cherry picked from commit 7f2006488e)
This commit is contained in:
Himself65
2023-06-07 22:47:02 +08:00
committed by himself65
parent afdf7e4fc6
commit ad2690026a
24 changed files with 60 additions and 91 deletions
@@ -35,22 +35,14 @@ function rpcToObservable<
});
}
type InferTFromEvent<E> = E extends (
callback: (t: infer T) => void
) => () => void
? T
: never;
type UpdateMeta = InferTFromEvent<typeof window.events.updater.onUpdateReady>;
export const updateReadyAtom = atomWithObservable(() => {
return rpcToObservable(null as UpdateMeta | null, {
return rpcToObservable(null as any | null, {
event: window.events?.updater.onUpdateReady,
});
});
export const updateAvailableAtom = atomWithObservable(() => {
return rpcToObservable(null as UpdateMeta | null, {
return rpcToObservable(null as any | null, {
event: window.events?.updater.onUpdateAvailable,
onSubscribe: () => {
window.apis?.updater.checkForUpdatesAndNotify();