Skip to content

Commit c85b73d

Browse files
authored
fix: allow typescript typechecking for electron-updater .d.ts (#8372)
1 parent e74f8f0 commit c85b73d

15 files changed

+166
-9273
lines changed

.changeset/selfish-ligers-cry.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"app-builder-lib": patch
3+
"electron-builder": patch
4+
"electron-updater": patch
5+
---
6+
7+
fix: allow enabling tsc lib checking on electron-updater package

packages/app-builder-lib/tsconfig-scheme.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@
99
"../../typings/*.d.ts"
1010
],
1111
"exclude": [
12-
"../../typings/electron.d.ts"
1312
]
1413
}

packages/app-builder-lib/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"../../typings/*.d.ts"
1515
],
1616
"exclude": [
17-
"../../typings/electron.d.ts"
1817
],
1918
"references": [
2019
{

packages/electron-builder/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,5 @@
2828
"../../typings/*.d.ts"
2929
],
3030
"exclude": [
31-
"../../typings/electron.d.ts"
3231
]
3332
}

packages/electron-updater/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"@types/js-yaml": "4.0.3",
3131
"@types/lodash.escaperegexp": "4.1.6",
3232
"@types/lodash.isequal": "4.5.5",
33-
"@types/semver": "^7.3.13"
33+
"@types/semver": "^7.3.13",
34+
"electron": "^31.2.1"
3435
},
3536
"typings": "./out/main.d.ts",
3637
"publishConfig": {

packages/electron-updater/src/AppUpdater.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { createClient, isUrlProbablySupportMultiRangeRequests } from "./provider
3030
import { ProviderPlatform } from "./providers/Provider"
3131
import type { TypedEmitter } from "tiny-typed-emitter"
3232
import Session = Electron.Session
33-
import { AuthInfo } from "electron"
33+
import type { AuthInfo } from "electron"
3434
import { gunzipSync } from "zlib"
3535
import { blockmapFiles } from "./util"
3636
import { DifferentialDownloaderOptions } from "./differentialDownloader/DifferentialDownloader"

packages/electron-updater/src/ElectronAppAdapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class ElectronAppAdapter implements AppAdapter {
2121
}
2222

2323
get appUpdateConfigPath(): string {
24-
return this.isPackaged ? path.join(process.resourcesPath!, "app-update.yml") : path.join(this.app.getAppPath(), "dev-app-update.yml")
24+
return this.isPackaged ? path.join(process.resourcesPath, "app-update.yml") : path.join(this.app.getAppPath(), "dev-app-update.yml")
2525
}
2626

2727
get userDataPath(): string {
@@ -41,6 +41,6 @@ export class ElectronAppAdapter implements AppAdapter {
4141
}
4242

4343
onQuit(handler: (exitCode: number) => void): void {
44-
this.app.once("quit", (_: Event, exitCode: number) => handler(exitCode))
44+
this.app.once("quit", (_: Electron.Event, exitCode: number) => handler(exitCode))
4545
}
4646
}

packages/electron-updater/src/NsisUpdater.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class NsisUpdater extends BaseUpdater {
144144
}
145145

146146
const callUsingElevation = (): void => {
147-
this.spawnLog(path.join(process.resourcesPath!, "elevate.exe"), [options.installerPath].concat(args)).catch(e => this.dispatchError(e))
147+
this.spawnLog(path.join(process.resourcesPath, "elevate.exe"), [options.installerPath].concat(args)).catch(e => this.dispatchError(e))
148148
}
149149

150150
if (options.isAdminRightsRequired) {

packages/electron-updater/src/electronHttpExecutor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DownloadOptions, HttpExecutor, configureRequestOptions, configureRequestUrl } from "builder-util-runtime"
2-
import { AuthInfo } from "electron"
2+
import type { AuthInfo } from "electron"
33
import { RequestOptions } from "http"
44
import Session = Electron.Session
55
import ClientRequest = Electron.ClientRequest
@@ -65,7 +65,7 @@ export class ElectronHttpExecutor extends HttpExecutor<Electron.ClientRequest> {
6565
const request = require("electron").net.request({
6666
...options,
6767
session: this.cachedSession,
68-
}) as Electron.ClientRequest
68+
})
6969
request.on("response", callback)
7070
if (this.proxyLoginCallback != null) {
7171
request.on("login", this.proxyLoginCallback)

packages/electron-updater/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function doLoadAutoUpdater(): AppUpdater {
3131
} else {
3232
_autoUpdater = new (require("./AppImageUpdater").AppImageUpdater)()
3333
try {
34-
const identity = path.join(process.resourcesPath!, "package-type")
34+
const identity = path.join(process.resourcesPath, "package-type")
3535
if (!existsSync(identity)) {
3636
return _autoUpdater
3737
}

packages/electron-updater/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"access": "public"
1111
},
1212
"files": [
13-
"../../typings/electron.d.ts"
1413
],
1514
"include": [
1615
"src/**/*.ts"

0 commit comments

Comments
 (0)