website
website copied to clipboard
Add TypeScript prop types to PageHeader component
Description
Components that accept props should have proper TypeScript interfaces or types defined for better type safety and developer experience.
Task
Review the PageHeader component and ensure it has:
- A proper TypeScript interface defining all props
- Exported types so other components can use them
- Optional/required props clearly marked
- JSDoc comments explaining what each prop does
Find the Component
Look for PageHeader.astro or PageHeader.tsx in:
-
src/components/
Example Structure
interface PageHeaderProps {
/** Main title of the page */
title: string;
/** Optional subtitle providing additional context */
subtitle?: string;
/** Small overline text above the title */
overline?: string;
}
export default function PageHeader({ title, subtitle, overline }: PageHeaderProps) {
// component implementation
}
Acceptance Criteria
- [ ] Props interface is defined
- [ ] All props have JSDoc comments
- [ ] Optional vs required props are clear
- [ ] Types are exported for reuse
- [ ] No TypeScript errors
Why This Matters
- Better autocomplete in IDEs
- Catches bugs at compile time
- Makes the component easier to use
- Self-documenting code
Great way to learn TypeScript interfaces and JSDoc!