Skip to content

Conversation

@ShubhamPatra
Copy link

This PR improves code quality by removing unnecessary debug logging and enhancing TypeScript type safety in the codebase.

Changes

  • Remove build-time console.log statements from compileMDX.ts that were logging cache hits/misses
  • Improve TypeScript types in usePendingRoute.ts by replacing any with NodeJS.Timeout | undefined
  • Add conditional guards before clearTimeout calls to prevent passing undefined values
  • Bump DISK_CACHE_BREAKER from 11 to 12 after modifying compileMDX.ts

This results in :

  1. Cleaner Build Output: The console logs in compileMDX.ts were debug statements that cluttered the build process without providing value to end users
  2. Better Type Safety: Replacing any with explicit types improves code maintainability and catches potential errors at compile time, aligning with the project's strict TypeScript configuration
  3. Cross-Environment Compatibility: Added proper type guards to handle NodeJS.Timeout type correctly in both server and client environments

Files Changed

  • src/utils/compileMDX.ts - Removed 2 console.log statements, bumped cache breaker
  • src/hooks/usePendingRoute.ts - Improved timer type definition and added null checks

…y- Remove build-time console.log statements from compileMDX.ts- Replace 'any' type with proper NodeJS.Timeout | undefined in usePendingRoute.ts- Add conditional guards before clearTimeout calls for type safety- Bump DISK_CACHE_BREAKER to invalidate MDX cache after changesImproves code quality and type safety while maintaining existing functionality.
@github-actions
Copy link

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant