diff --git a/.changeset/weak-mice-boil.md b/.changeset/weak-mice-boil.md new file mode 100644 index 0000000000..7ee05f6d2d --- /dev/null +++ b/.changeset/weak-mice-boil.md @@ -0,0 +1,5 @@ +--- +"electron-updater": patch +--- + +fix(docs): improve `downloadUpdate` typing to match the doc diff --git a/docs/api/electron-builder.md b/docs/api/electron-builder.md index 2d133713a3..59bed7bc81 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 6a68f15219..8f39a29f97 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 25dd721287..cf65eb0717 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")