From a5b433988433adb9481e90a80cd7642041b6f8ed Mon Sep 17 00:00:00 2001 From: Alice Zhao Date: Thu, 12 Dec 2024 07:56:27 -0800 Subject: [PATCH] fix: add missing index arg in `navigationHistory.canGoToOffset` (#44989) fix: add missing arg --- lib/browser/api/web-contents.ts | 4 ++-- typings/internal-electron.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts index cc5f376e93..2e37f43917 100644 --- a/lib/browser/api/web-contents.ts +++ b/lib/browser/api/web-contents.ts @@ -514,9 +514,9 @@ WebContents.prototype.canGoForward = function () { }; const canGoToOffsetDeprecated = deprecate.warnOnce('webContents.canGoToOffset', 'webContents.navigationHistory.canGoToOffset'); -WebContents.prototype.canGoToOffset = function () { +WebContents.prototype.canGoToOffset = function (index: number) { canGoToOffsetDeprecated(); - return this._canGoToOffset(); + return this._canGoToOffset(index); }; const clearHistoryDeprecated = deprecate.warnOnce('webContents.clearHistory', 'webContents.navigationHistory.clear'); diff --git a/typings/internal-electron.d.ts b/typings/internal-electron.d.ts index b213b031a6..0f2cc17c28 100644 --- a/typings/internal-electron.d.ts +++ b/typings/internal-electron.d.ts @@ -93,7 +93,7 @@ declare namespace Electron { _historyLength(): number; _canGoBack(): boolean; _canGoForward(): boolean; - _canGoToOffset(): boolean; + _canGoToOffset(index: number): boolean; _goBack(): void; _goForward(): void; _goToOffset(index: number): void;