From 8756316d7cfca7164cbd9f2fd34c897ba580561a Mon Sep 17 00:00:00 2001 From: repo-worker-code Date: Tue, 3 Nov 2026 10:10:59 -0600 Subject: [PATCH] fix(id/web): assert plugin non-null in image-upload paste helper (#3249) The #1323 batch-ordering describe narrows `plugin` with an early throw, but TypeScript does not carry the narrowing into the nested `paste()` helper declaration, so `handlePaste!.call(plugin, ...)` passed `Plugin | null` where ProseMirror's handler types its thisArg as `Plugin`. `tsc --noEmit` was red on main with this single TS2345 and nothing else. Use the file's existing convention (the surrounding helpers already write `plugin!` when passing it into `plugins`) at the call site. No behaviour change: the describe body has already thrown if plugin is null, and the suite's 47 tests are unchanged and pass. --- pkgs/id/web/src/image-upload.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/id/web/src/image-upload.test.ts b/pkgs/id/web/src/image-upload.test.ts index 08ddc71482..ef95316b4d 100644 --- a/pkgs/id/web/src/image-upload.test.ts +++ b/pkgs/id/web/src/image-upload.test.ts @@ -425,7 +425,7 @@ describe("handlePaste batch ordering (#1323)", () => { function paste(v: EditorView, files: File[]): void { const event = { clipboardData: { files }, preventDefault: vi.fn() }; - const result = handlePaste!.call(plugin, v, event as unknown as ClipboardEvent, undefined as unknown as Slice); + const result = handlePaste!.call(plugin!, v, event as unknown as ClipboardEvent, undefined as unknown as Slice); expect(result).toBe(true); }