Skip to content

Refactor: Consolidate duplicated BlogPost interface into a shared type#98

Open
Atharva0506 wants to merge 1 commit intoStabilityNexus:mainfrom
Atharva0506:refactor/consolidate-blog-post-type
Open

Refactor: Consolidate duplicated BlogPost interface into a shared type#98
Atharva0506 wants to merge 1 commit intoStabilityNexus:mainfrom
Atharva0506:refactor/consolidate-blog-post-type

Conversation

@Atharva0506
Copy link
Copy Markdown

@Atharva0506 Atharva0506 commented Apr 14, 2026

Addressed Issues:

Fixes #(TODO:issue number)

Screenshots/Recordings:

No visual changes. This is a pure codebase health/refactoring update.

Description:

This pull request addresses code duplication by consolidating the BlogPost interface, which was previously defined independently across 4 separate files, into a single central source of truth in types/blog.ts.
All component and utility consumers (lib/blog.ts, lib/blog-server.ts, app/page.tsx, components/blog-card.tsx, and app/a/[slug]/BlogPostClient.tsx) have been updated to utilize TypeScript's import type to import the shared BlogPost and PaginatedPosts interfaces. This change ensures type consistency, improves maintainability, and follows DRY principles.

Additional Notes:

  • Adhered to the import type standard for TypeScript imports.
  • Created types/blog.ts to host global types.
  • The PaginatedData inline type in lib/blog.ts and app/page.tsx was also extracted to PaginatedPosts in the new types file.

AI Usage Disclosure:

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: TODO

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.

Summary by CodeRabbit

  • Refactor
    • Internal code organization improvements to enhance codebase maintainability and structure.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4b0d4200-ec1c-4854-9287-0531442c5b3b

📥 Commits

Reviewing files that changed from the base of the PR and between 865ea0d and 4ab7d2e.

📒 Files selected for processing (6)
  • app/a/[slug]/BlogPostClient.tsx
  • app/page.tsx
  • components/blog-card.tsx
  • lib/blog-server.ts
  • lib/blog.ts
  • types/blog.ts

Walkthrough

The PR consolidates blog-related TypeScript type definitions from multiple files into a centralized types/blog.ts module. The BlogPost and PaginatedPosts interfaces are now exported from the new shared types file, and all consuming modules are updated to import these types instead of defining them locally.

Changes

Cohort / File(s) Summary
Type Definition Consolidation
types/blog.ts
New centralized module exporting BlogPost and PaginatedPosts type interfaces previously scattered across other files.
Blog Library Updates
lib/blog.ts, lib/blog-server.ts
Removed local BlogPost interface declarations and replaced with type-only imports from @/types/blog. Updated function return types to reference the shared PaginatedPosts type.
Component & Page Updates
components/blog-card.tsx, app/page.tsx, app/a/[slug]/BlogPostClient.tsx
Removed locally declared type interfaces and updated import statements to use BlogPost and PaginatedPosts from the centralized @/types/blog module.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

Typescript Lang

Suggested reviewers

  • ceilican

Poem

🐰 Types scattered far, now gathered near,
In types/blog, crystal and clear,
No more duplication, just one shared source,
Blog posts hop along their proper course! ✨

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main refactoring objective: consolidating duplicate BlogPost interfaces into a shared type definition.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Atharva0506 Atharva0506 marked this pull request as ready for review April 14, 2026 09:13
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