fix: Phase 7b - suppress MSW optional dependency errors (34 -> 32 errors)

Fixed TypeScript errors for optional MSW (Mock Service Worker) test dependency.

MSW is intentionally optional - tests work with or without it. The dynamic
imports are wrapped in try-catch to gracefully handle when MSW is not installed.

Added @ts-expect-error comments to suppress TypeScript module resolution errors
for the optional dynamic imports, while maintaining the runtime fallback behavior.

Changes:
- src/lib/api/adapters/test-setup.ts:
  - Added @ts-expect-error for 'msw/node' dynamic import
  - Added @ts-expect-error for 'msw' dynamic import
  - Preserves optional dependency pattern

Result: 34 → 32 errors (-2)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Justin Edmund 2025-11-28 19:56:51 -08:00
parent e23276b4de
commit c2329c2f7f

View file

@ -8,7 +8,9 @@ let HttpResponse: any = null
async function ensureMSW() {
if (mockServer) return
try {
// @ts-expect-error - MSW is an optional dependency for testing
const mswNode = await import('msw/node')
// @ts-expect-error - MSW is an optional dependency for testing
const msw = await import('msw')
mockServer = mswNode.setupServer()
http = msw.http