You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Vue and am trying to handle an ipcRenderer event that uses different electron-updater args but am failing to properly type them, currently I'm using this:
typeUpdaterEventArg=|{status: "error";error: Error;message?: string}|{status: "download-progress";progressInfo: ProgressInfo}|{status: "update-downloaded";event: UpdateDownloadedEvent}|{status: "update-not-available";updateInfo: UpdateInfo}|{status: "checking-for-update"}|{status: "update-available";updateInfo: UpdateInfo};ipcRenderer.on("updaterHandler",(_event,status: string,arg: UpdaterEventArg)=>{console.log(`updaterHandler: ${status}`);if(status==="checking-for-update"){// No additional data for this statusreturn;}this.updater.status=status;if(status==="download-progress"&&"progressInfo"inarg){this.updater.progress=Math.floor(arg.progressInfo.percent);}if((status==="update-available"||status==="update-not-available"||status==="update-downloaded")&&"updateInfo"inarg){this.updater.path=`https://github.com/WeakAuras/WeakAuras-Companion/releases/download/v${arg.updateInfo.version}/${arg.updateInfo.path}`;this.updater.version=arg.updateInfo.version;// List if `updater.fullChangelog` is set to `true`, `string` otherwise.if(typeofarg.updateInfo.releaseNotes==="string"){this.updater.releaseNotes=arg.updateInfo.releaseNotes;}elseif(Array.isArray(arg.updateInfo.releaseNotes)){// Convert the array of ReleaseNoteInfo to a stringthis.updater.releaseNotes=arg.updateInfo.releaseNotes.map((note)=>note.note).join("\n");}else{this.updater.releaseNotes="";}console.log(JSON.stringify(arg));}if(status==="error"&&"error"inarg){console.error(arg.error);}},);
There are several problems with this:
UpdateInfo is not available on update-available, instead the fields are on arc directly, see this dump:
But when I try to adjust my code to use arg.version instead of arg.updateInfo.version the types fail. I'm unsure how to fix this type declaration and was hoping for some help from the community. Also the docs confused me here, https://www.electron.build/auto-update.html#event-update-available says there should be updateInfo.
The text was updated successfully, but these errors were encountered:
6.1.8
I'm using Vue and am trying to handle an ipcRenderer event that uses different electron-updater args but am failing to properly type them, currently I'm using this:
There are several problems with this:
UpdateInfo
is not available onupdate-available
, instead the fields are onarc
directly, see this dump:But when I try to adjust my code to use
arg.version
instead ofarg.updateInfo.version
the types fail. I'm unsure how to fix this type declaration and was hoping for some help from the community. Also the docs confused me here, https://www.electron.build/auto-update.html#event-update-available says there should beupdateInfo
.The text was updated successfully, but these errors were encountered: