From 3362015076bba19952e22aa8c2aede2679f24ecd Mon Sep 17 00:00:00 2001 From: Alaister Young <10985857+alaister@users.noreply.github.com> Date: Tue, 14 Apr 2026 11:50:40 +0900 Subject: [PATCH] fix: resolve type errors from vitest 4 Mock type changes vi.fn() now returns Mock in vitest 4, which isn't directly callable or assignable to typed function signatures. Fix by narrowing the mock type where it's called directly, and casting at the assignment site for global.fetch. --- .../interfaces/Support/__tests__/SupportFormPage.test.tsx | 2 +- apps/studio/lib/ai/tools/incident-tools.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/studio/components/interfaces/Support/__tests__/SupportFormPage.test.tsx b/apps/studio/components/interfaces/Support/__tests__/SupportFormPage.test.tsx index 3c506a3c783..7f23f15cedc 100644 --- a/apps/studio/components/interfaces/Support/__tests__/SupportFormPage.test.tsx +++ b/apps/studio/components/interfaces/Support/__tests__/SupportFormPage.test.tsx @@ -108,7 +108,7 @@ vi.mock(import('@/lib/breadcrumbs'), async (importOriginal) => { let createSupportStorageClientMock: ReturnType let getBreadcrumbSnapshotMock: ReturnType -let generateAttachmentUrlSpy: ReturnType +let generateAttachmentUrlSpy: ReturnType any>> // Mock sonner toast vi.mock('sonner', () => ({ diff --git a/apps/studio/lib/ai/tools/incident-tools.test.ts b/apps/studio/lib/ai/tools/incident-tools.test.ts index ab39d0a94ec..dee4afe52c9 100644 --- a/apps/studio/lib/ai/tools/incident-tools.test.ts +++ b/apps/studio/lib/ai/tools/incident-tools.test.ts @@ -14,7 +14,7 @@ describe('ai/tools/incident-tools', () => { beforeEach(() => { vi.clearAllMocks() mockFetch = vi.fn() - global.fetch = mockFetch + global.fetch = mockFetch as typeof fetch // Mock AbortSignal.timeout mockAbortSignal = new AbortController().signal