feat: add TypeScript types for components and API functions #135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Tickets & Documents
Fixes: #1768
Description
This PR introduces comprehensive TypeScript typings across the frontend components and backend API functions to enhance type safety and developer experience. No UI or functional behavior has been changed.
Changes
API Layer (lib/api.ts): Added strict parameter and return types using shared interfaces.
Type Definitions: Utilized interfaces from types/post.ts, types/tag.ts, and types/api.ts.
Component Typings Added:
PostPreview
PostHeader
PostTitle
Header
Layout
TagsPostPreview
PostHeaderAuthors
SubscribeNewsletter
TopBlogs
Tag
NotFoundPage
Container
AdSlot
Date
Avatar
Alert
Marquee
TwitterTestimonials
Prop types are now explicitly defined for all components, improving code clarity and editor support.
Type of Change
New feature (adds typing and developer tooling improvements)
Testing
Verified local development server (npm run dev) starts and runs without errors.
TypeScript compiler (tsc) passes with zero errors.
Demo
N/A (no UI or runtime changes)
Environment and Dependencies
New Dependencies: None
Configuration Changes: None
Checklist
Code adheres to project style guidelines
Self-reviewed code changes
Documentation updated where necessary