Description
Enhance type safety across the codebase by improving type hints, using more specific return types, and better leveraging Python's generic type system.
Current Issues
- Some functions return object or overly broad types
- Generic types not used where appropriate
- Union types could be more specific
- Missing type hints in some newer functions
Proposed Solution
- Replace broad types (object, Any) with specific types
- Use TypeVar and generics for reusable functions
- Implement proper Protocol classes for interfaces
- Add missing type hints to all functions
- Use Literal types for string constants
Acceptance Criteria
- MyPy passes with strict mode enabled
- No use of Any or object except where truly necessary
- Generic types used appropriately for collections and functions
- All functions have complete type annotations
- Protocol classes defined for clear interfaces