From acccd6c3a76e3be2bde5afd74104888a4dfab56a Mon Sep 17 00:00:00 2001 From: Johnpaul Date: Wed, 21 Jan 2026 21:48:30 +0100 Subject: [PATCH] refactor: remove any types from contextMenuCompat.test.ts - Replace ...args: any[] with proper return type annotations - Replace (original as any).apply() with original.call() - Replace (originalGetCanvasMenuOptions as any).apply() with .call() - Add explicit return type (IContextMenuValue | null)[] to functions --- src/lib/litegraph/src/contextMenuCompat.test.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lib/litegraph/src/contextMenuCompat.test.ts b/src/lib/litegraph/src/contextMenuCompat.test.ts index fc4c7d156..98d8595a3 100644 --- a/src/lib/litegraph/src/contextMenuCompat.test.ts +++ b/src/lib/litegraph/src/contextMenuCompat.test.ts @@ -54,11 +54,12 @@ describe('contextMenuCompat', () => { // Simulate extension monkey-patching const original = LGraphCanvas.prototype.getCanvasMenuOptions - LGraphCanvas.prototype.getCanvasMenuOptions = function (...args: any[]) { - const items = (original as any).apply(this, args) - items.push({ content: 'Custom Item', callback: () => {} }) - return items - } + LGraphCanvas.prototype.getCanvasMenuOptions = + function (): (IContextMenuValue | null)[] { + const items = original.call(this) + items.push({ content: 'Custom Item', callback: () => {} }) + return items + } // Should have logged a warning with extension name expect(warnSpy).toHaveBeenCalledWith( @@ -83,8 +84,10 @@ describe('contextMenuCompat', () => { legacyMenuCompat.install(LGraphCanvas.prototype, methodName) legacyMenuCompat.setCurrentExtension('test.extension') - const patchFunction = function (this: LGraphCanvas, ...args: any[]) { - const items = (originalGetCanvasMenuOptions as any).apply(this, args) + const patchFunction = function ( + this: LGraphCanvas + ): (IContextMenuValue | null)[] { + const items = originalGetCanvasMenuOptions.call(this) items.push({ content: 'Custom', callback: () => {} }) return items }