Skip to content

fix: resolve TypeScript errors in test files #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2025

Conversation

nullcoder
Copy link
Owner

Summary

Fixes all TypeScript errors that were preventing npm run typecheck from passing.

Changes

components/theme-toggle.test.tsx

  • Fixed mocking of next-themes module with proper type annotations
  • Resolved "Property 'useTheme' does not exist" error
  • Properly typed the mock functions and return values

lib/errors.test.ts

  • Added type annotation for vi.importMock<typeof import("./logger")>
  • Fixed handler function type annotation to return Promise<Response>
  • Resolved "'loggerModule.logger' is of type 'unknown'" error

lib/logger.test.ts

  • Added type annotations for vi.importMock<typeof import("./environment")>
  • Resolved "Object is of type 'unknown'" errors

Result

✅ All TypeScript errors resolved
npm run typecheck passes without errors
✅ All affected tests passing

🤖 Generated with Claude Code

- Fix theme-toggle.test.tsx: Properly mock next-themes module with correct typing
- Fix errors.test.ts: Add proper type annotations for vi.importMock and handler function
- Fix logger.test.ts: Add type annotations for vi.importMock calls
- All TypeScript errors resolved, type checking passes
- All affected tests passing

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

Co-Authored-By: Claude <noreply@anthropic.com>
@nullcoder nullcoder merged commit b03260a into main Jun 6, 2025
1 check was pending
@nullcoder nullcoder deleted the fix/typescript-errors branch June 6, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant