From 3493df464bcfcf4687d4e5e85e72858328357309 Mon Sep 17 00:00:00 2001 From: Mantra <87142457+mantrakp04@users.noreply.github.com> Date: Thu, 18 Jun 2026 17:55:17 -0700 Subject: [PATCH] Fix typecheck in template cross-domain test (#1628) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What Fixes a TypeScript error in `@hexclave/template` that was breaking `pnpm typecheck` repo-wide: ``` client-app-impl.cross-domain.test.ts(450,101): error TS2345: Argument of type '(options: { url: string | URL; }) => Promise' is not assignable to parameter of type '(...args: unknown[]) => unknown'. ``` ## Why The `vi.spyOn(...).mockImplementation(...)` callback typed its parameter directly as `{ url: string | URL }`, but `mockImplementation` expects `(...args: unknown[]) => unknown`. `unknown` isn't assignable to `{ url }`, so the build failed. ## How Accept variadic `unknown[]` args and cast `args[0]` to the expected shape — matching the spy's actual signature while preserving the test's behavior. `pnpm --filter=@hexclave/template typecheck` now passes. --- ## Summary by cubic Fix TypeScript typecheck failure in `@hexclave/template` cross-domain auth test by updating the `vi.spyOn(...)._redirectTo.mockImplementation` to accept `(...args: unknown[])` and casting `args[0]` to `{ url: string | URL }`. This aligns the mock with its expected signature and restores `pnpm typecheck`. Written for commit 4a1787ee663140ed433c3d96b5e316ab32942535. Summary will update on new commits. Review in cubic --- .../apps/implementations/client-app-impl.cross-domain.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/template/src/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.ts b/packages/template/src/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.ts index 1dd115412..be344a23b 100644 --- a/packages/template/src/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.ts +++ b/packages/template/src/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.ts @@ -447,7 +447,8 @@ describe("StackClientApp cross-domain auth", () => { })); let currentHref = callbackUrl.toString(); let redirectedUrl = ""; - const redirectSpy = vi.spyOn(StackClientApp.prototype as any, "_redirectTo").mockImplementation(async (options: { url: string | URL }) => { + const redirectSpy = vi.spyOn(StackClientApp.prototype as any, "_redirectTo").mockImplementation(async (...args: unknown[]) => { + const options = args[0] as { url: string | URL }; redirectedUrl = options.url.toString(); });