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 }