From d9e0d4f7cbef94e417d88bb72b647909c26548ed Mon Sep 17 00:00:00 2001 From: Alexandre Le Foll Date: Mon, 29 Aug 2022 15:54:49 +1000 Subject: [PATCH 1/2] fix: improve `downloadUpdate` typing to match the doc --- docs/api/electron-builder.md | 16 ++++++++-------- docs/auto-update.md | 16 ++++++++-------- packages/electron-updater/src/AppUpdater.ts | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/api/electron-builder.md b/docs/api/electron-builder.md index 2d133713a38..59bed7bc819 100644 --- a/docs/api/electron-builder.md +++ b/docs/api/electron-builder.md @@ -1423,7 +1423,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc
  • .addAuthHeader(token)
  • .checkForUpdates()Promise< | UpdateCheckResult>
  • .checkForUpdatesAndNotify(downloadNotification)Promise< | UpdateCheckResult>
  • -
  • .downloadUpdate(cancellationToken)Promise<any>
  • +
  • .downloadUpdate(cancellationToken)Promise<Array<String>>
  • .getFeedURL()undefined | null | String
  • .setFeedURL(options)
  • .isUpdaterActive()Boolean
  • @@ -1436,7 +1436,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc
  • .addAuthHeader(token)
  • .checkForUpdates()Promise< | UpdateCheckResult>
  • .checkForUpdatesAndNotify(downloadNotification)Promise< | UpdateCheckResult>
  • -
  • .downloadUpdate(cancellationToken)Promise<any>
  • +
  • .downloadUpdate(cancellationToken)Promise<Array<String>>
  • .getFeedURL()undefined | null | String
  • .setFeedURL(options)
  • .isUpdaterActive()Boolean
  • @@ -1634,7 +1634,7 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc
  • .addAuthHeader(token)
  • .checkForUpdates()Promise< | UpdateCheckResult>
  • .checkForUpdatesAndNotify(downloadNotification)Promise< | UpdateCheckResult>
  • -
  • .downloadUpdate(cancellationToken)Promise<any>
  • +
  • .downloadUpdate(cancellationToken)Promise<Array<String>>
  • .getFeedURL()undefined | null | String
  • .setFeedURL(options)
  • .isUpdaterActive()Boolean
  • @@ -1679,9 +1679,9 @@ return path.join(target.outDir, __${target.name}-${getArtifactArchName(arc

    -

    appUpdater.downloadUpdate(cancellationToken)Promise<any>

    +

    appUpdater.downloadUpdate(cancellationToken)Promise<Array<String>>

    Start downloading update manually. You can use this method if autoDownload option is set to false.

    -

    Returns: Promise<any> - Path to downloaded file.

    +

    Returns: Promise<Array<String>> - Paths to downloaded files.

    @@ -1757,7 +1757,7 @@ This is different from the normal quit event sequence.

  • .addAuthHeader(token)
  • .checkForUpdates()Promise< | UpdateCheckResult>
  • .checkForUpdatesAndNotify(downloadNotification)Promise< | UpdateCheckResult>
  • -
  • .downloadUpdate(cancellationToken)Promise<any>
  • +
  • .downloadUpdate(cancellationToken)Promise<Array<String>>
  • .getFeedURL()undefined | null | String
  • .setFeedURL(options)
  • .isUpdaterActive()Boolean
  • @@ -1804,9 +1804,9 @@ This is different from the normal quit event sequence.

    -

    macUpdater.downloadUpdate(cancellationToken)Promise<any>

    +

    macUpdater.downloadUpdate(cancellationToken)Promise<Array<String>>

    Start downloading update manually. You can use this method if autoDownload option is set to false.

    -

    Returns: Promise<any> - Path to downloaded file.

    +

    Returns: Promise<Array<String>> - Paths to downloaded files.

    diff --git a/docs/auto-update.md b/docs/auto-update.md index 6a68f152196..8f39a29f972 100644 --- a/docs/auto-update.md +++ b/docs/auto-update.md @@ -837,7 +837,7 @@ Access key is required, define `DO_KEY_ID` and `DO_SECRET_KEY` environment varia * [`.addAuthHeader(token)`](#module_electron-updater.AppUpdater+addAuthHeader) * [`.checkForUpdates()`](#module_electron-updater.AppUpdater+checkForUpdates) ⇒ Promise<[UpdateCheckResult](#UpdateCheckResult)> * [`.checkForUpdatesAndNotify(downloadNotification)`](#module_electron-updater.AppUpdater+checkForUpdatesAndNotify) ⇒ Promise< \| [UpdateCheckResult](#UpdateCheckResult)> - * [`.downloadUpdate(cancellationToken)`](#module_electron-updater.AppUpdater+downloadUpdate) ⇒ Promise<any> + * [`.downloadUpdate(cancellationToken)`](#module_electron-updater.AppUpdater+downloadUpdate) ⇒ Promise<Array<String>> * [`.getFeedURL()`](#module_electron-updater.AppUpdater+getFeedURL) ⇒ undefined \| null \| String * [`.setFeedURL(options)`](#module_electron-updater.AppUpdater+setFeedURL) * [`.isUpdaterActive()`](#module_electron-updater.AppUpdater+isUpdaterActive) ⇒ Boolean @@ -847,7 +847,7 @@ Access key is required, define `DO_KEY_ID` and `DO_SECRET_KEY` environment varia * [`.addAuthHeader(token)`](#module_electron-updater.AppUpdater+addAuthHeader) * [`.checkForUpdates()`](#module_electron-updater.AppUpdater+checkForUpdates) ⇒ Promise<[UpdateCheckResult](#UpdateCheckResult)> * [`.checkForUpdatesAndNotify(downloadNotification)`](#module_electron-updater.AppUpdater+checkForUpdatesAndNotify) ⇒ Promise< \| [UpdateCheckResult](#UpdateCheckResult)> - * [`.downloadUpdate(cancellationToken)`](#module_electron-updater.AppUpdater+downloadUpdate) ⇒ Promise<any> + * [`.downloadUpdate(cancellationToken)`](#module_electron-updater.AppUpdater+downloadUpdate) ⇒ Promise<Array<String>> * [`.getFeedURL()`](#module_electron-updater.AppUpdater+getFeedURL) ⇒ undefined \| null \| String * [`.setFeedURL(options)`](#module_electron-updater.AppUpdater+setFeedURL) * [`.isUpdaterActive()`](#module_electron-updater.AppUpdater+isUpdaterActive) ⇒ Boolean @@ -954,7 +954,7 @@ Access key is required, define `DO_KEY_ID` and `DO_SECRET_KEY` environment varia * [`.addAuthHeader(token)`](#module_electron-updater.AppUpdater+addAuthHeader) * [`.checkForUpdates()`](#module_electron-updater.AppUpdater+checkForUpdates) ⇒ Promise<[UpdateCheckResult](#UpdateCheckResult)> * [`.checkForUpdatesAndNotify(downloadNotification)`](#module_electron-updater.AppUpdater+checkForUpdatesAndNotify) ⇒ Promise< \| [UpdateCheckResult](#UpdateCheckResult)> - * [`.downloadUpdate(cancellationToken)`](#module_electron-updater.AppUpdater+downloadUpdate) ⇒ Promise<any> + * [`.downloadUpdate(cancellationToken)`](#module_electron-updater.AppUpdater+downloadUpdate) ⇒ Promise<Array<String>> * [`.getFeedURL()`](#module_electron-updater.AppUpdater+getFeedURL) ⇒ undefined \| null \| String * [`.setFeedURL(options)`](#module_electron-updater.AppUpdater+setFeedURL) * [`.isUpdaterActive()`](#module_electron-updater.AppUpdater+isUpdaterActive) ⇒ Boolean @@ -977,10 +977,10 @@ Asks the server whether there is an update. - downloadNotification module:electron-updater/out/AppUpdater.DownloadNotification -#### `appUpdater.downloadUpdate(cancellationToken)` ⇒ Promise<any> +#### `appUpdater.downloadUpdate(cancellationToken)` ⇒ Promise<Array<String>> Start downloading update manually. You can use this method if `autoDownload` option is set to `false`. -**Returns**: Promise<any> - Path to downloaded file. +**Returns**: Promise<Array<String>> - Paths to downloaded files. - cancellationToken CancellationToken @@ -1017,7 +1017,7 @@ This is different from the normal quit event sequence. * [`.addAuthHeader(token)`](#module_electron-updater.AppUpdater+addAuthHeader) * [`.checkForUpdates()`](#module_electron-updater.AppUpdater+checkForUpdates) ⇒ Promise<[UpdateCheckResult](#UpdateCheckResult)> * [`.checkForUpdatesAndNotify(downloadNotification)`](#module_electron-updater.AppUpdater+checkForUpdatesAndNotify) ⇒ Promise< \| [UpdateCheckResult](#UpdateCheckResult)> - * [`.downloadUpdate(cancellationToken)`](#module_electron-updater.AppUpdater+downloadUpdate) ⇒ Promise<any> + * [`.downloadUpdate(cancellationToken)`](#module_electron-updater.AppUpdater+downloadUpdate) ⇒ Promise<Array<String>>/code> * [`.getFeedURL()`](#module_electron-updater.AppUpdater+getFeedURL) ⇒ undefined \| null \| String * [`.setFeedURL(options)`](#module_electron-updater.AppUpdater+setFeedURL) * [`.isUpdaterActive()`](#module_electron-updater.AppUpdater+isUpdaterActive) ⇒ Boolean @@ -1042,10 +1042,10 @@ Asks the server whether there is an update. - downloadNotification module:electron-updater/out/AppUpdater.DownloadNotification -#### `macUpdater.downloadUpdate(cancellationToken)` ⇒ Promise<any> +#### `macUpdater.downloadUpdate(cancellationToken)` ⇒ Promise<Array<String>> Start downloading update manually. You can use this method if `autoDownload` option is set to `false`. -**Returns**: Promise<any> - Path to downloaded file. +**Returns**: Promise<Array<String>> - Paths to downloaded files. - cancellationToken CancellationToken diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts index 25dd7212878..cf65eb0717e 100644 --- a/packages/electron-updater/src/AppUpdater.ts +++ b/packages/electron-updater/src/AppUpdater.ts @@ -444,9 +444,9 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter /** * Start downloading update manually. You can use this method if `autoDownload` option is set to `false`. - * @returns {Promise} Path to downloaded file. + * @returns {Promise>} Paths to downloaded files. */ - downloadUpdate(cancellationToken: CancellationToken = new CancellationToken()): Promise { + downloadUpdate(cancellationToken: CancellationToken = new CancellationToken()): Promise> { const updateInfoAndProvider = this.updateInfoAndProvider if (updateInfoAndProvider == null) { const error = new Error("Please check update first") From d472ec9719795b3a8bbc055e53423f33ed7bdf99 Mon Sep 17 00:00:00 2001 From: Mike Maietta Date: Sun, 28 Aug 2022 23:38:16 -0700 Subject: [PATCH 2/2] Create weak-mice-boil.md --- .changeset/weak-mice-boil.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/weak-mice-boil.md diff --git a/.changeset/weak-mice-boil.md b/.changeset/weak-mice-boil.md new file mode 100644 index 00000000000..7ee05f6d2d6 --- /dev/null +++ b/.changeset/weak-mice-boil.md @@ -0,0 +1,5 @@ +--- +"electron-updater": patch +--- + +fix(docs): improve `downloadUpdate` typing to match the doc