Files
compiler-explorer/shared
Matt GodboltandClaude 716d571cc3 Refactor explain-view.ts following TypeScript best practices
Major improvements:
- Add capitaliseFirst() utility function with comprehensive tests
- DRY up status icon management with enum and configuration object
- Make DOM element fields readonly where appropriate
- Extract reusable select population and popover content helpers
- Simplify control flow with focused single-responsibility methods
- Improve error handling with dedicated handleFetchError() method
- Extract cache handling into displayCachedResult() and fetchFromAPI()
- Move event handlers to named methods with proper binding
- Apply modern TypeScript features (nullish coalescing, spread operator)
- Reorganize constructor for better readability

Results:
- Eliminated ~50 lines of duplicated code
- Enhanced type safety and maintainability
- Follows all project TypeScript conventions
- Preserves 100% existing functionality

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 10:46:40 -05:00
..