@@ -3,6 +3,7 @@ import { createRequire } from 'node:module'
33import type {
44 ProgressInfo ,
55 UpdateDownloadedEvent ,
6+ UpdateInfo ,
67} from 'electron-updater'
78
89const { autoUpdater } = createRequire ( import . meta. url ) ( 'electron-updater' ) ;
@@ -17,11 +18,11 @@ export function update(win: Electron.BrowserWindow) {
1718 // start check
1819 autoUpdater . on ( 'checking-for-update' , function ( ) { } )
1920 // update available
20- autoUpdater . on ( 'update-available' , ( arg ) => {
21+ autoUpdater . on ( 'update-available' , ( arg : UpdateInfo ) => {
2122 win . webContents . send ( 'update-can-available' , { update : true , version : app . getVersion ( ) , newVersion : arg ?. version } )
2223 } )
2324 // update not available
24- autoUpdater . on ( 'update-not-available' , ( arg ) => {
25+ autoUpdater . on ( 'update-not-available' , ( arg : UpdateInfo ) => {
2526 win . webContents . send ( 'update-can-available' , { update : false , version : app . getVersion ( ) , newVersion : arg ?. version } )
2627 } )
2728
@@ -40,7 +41,7 @@ export function update(win: Electron.BrowserWindow) {
4041 } )
4142
4243 // Start downloading and feedback on progress
43- ipcMain . handle ( 'start-download' , ( event ) => {
44+ ipcMain . handle ( 'start-download' , ( event : Electron . IpcMainInvokeEvent ) => {
4445 startDownload (
4546 ( error , progressInfo ) => {
4647 if ( error ) {
@@ -68,8 +69,8 @@ function startDownload(
6869 callback : ( error : Error | null , info : ProgressInfo | null ) => void ,
6970 complete : ( event : UpdateDownloadedEvent ) => void ,
7071) {
71- autoUpdater . on ( 'download-progress' , info => callback ( null , info ) )
72- autoUpdater . on ( 'error' , error => callback ( error , null ) )
72+ autoUpdater . on ( 'download-progress' , ( info : ProgressInfo ) => callback ( null , info ) )
73+ autoUpdater . on ( 'error' , ( error : Error ) => callback ( error , null ) )
7374 autoUpdater . on ( 'update-downloaded' , complete )
7475 autoUpdater . downloadUpdate ( )
7576}
0 commit comments