fix: improve TypeScript types for better IDE code hinting

- Install @types/bun and @types/jsdom for proper type definitions
- Fix mock function typing in test files
- Create jest-dom.d.ts to properly extend Bun's Matchers interface
- Remove MockedFunction imports (not supported in Bun's types)
- Cast global.fetch and useSession mocks to any where needed
- Fix mock.module return types to match expected signatures

This resolves TypeScript errors that were preventing proper code
completion and type checking in IDEs.
This commit is contained in:
2026-04-01 12:44:44 -07:00
parent e8f0fd2538
commit ed43399b24
6 changed files with 48 additions and 33 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
import { describe, it, expect, mock, beforeEach, MockedFunction } from 'bun:test'
import { describe, it, expect, mock, beforeEach } from 'bun:test'
import { render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import EditTournamentForm from '@/components/EditTournamentForm'
@@ -18,8 +18,8 @@ mock.module('next/link', () => ({
}))
// Mock fetch
const mockFetch = mock(() => {})
global.fetch = mockFetch as MockedFunction<typeof global.fetch>
const mockFetch = mock(async () => new Response())
global.fetch = mockFetch as any
const mockTournament = {
id: 1,