This project has been configured with TypeScript support for better type safety and developer experience. Here's what you need to know:
- TypeScript configuration is in
tsconfig.json
- Global type declarations are in
src/types/global.d.ts
- Shared interfaces and types are in
src/types/portfolio.ts
Core Files:
src/App.tsx
- Main application componentsrc/index.tsx
- Entry pointsrc/theme.ts
- Theme configurationsrc/portfolio.ts
- Portfolio data with type definitionssrc/reportWebVitals.ts
- Performance monitoring
Components:
src/components/header/Header.tsx
src/components/footer/Footer.tsx
src/components/socialMedia/SocialMedia.tsx
src/components/softwareSkills/SoftwareSkill.tsx
src/components/topButton/TopButton.tsx
src/components/Loader/LoaderLogo.tsx
src/components/experienceCard/ExperienceCard.tsx
src/components/experienceSectionCard/ExperienceSectionCard.tsx
src/components/mainProjectCard/MainProjectCard.tsx
src/components/sideProjectCard/SideProjectCard.tsx
src/components/projectLanguages/ProjectLanguages.tsx
Pages and Containers:
src/pages/home/HomeComponent.tsx
src/containers/greeting/Greeting.tsx
src/containers/skills/Skills.tsx
src/containers/skills/SkillSection.tsx
Key type definitions in src/types/portfolio.ts
:
Skills
- Interface for skills data structureSoftwareSkill
- Interface for individual skill itemsSkillCategory
- Interface for skill categoriesExperience
- Interface for experience itemsProject
- Interface for project items
-
New components should be created with
.tsx
extension if they contain JSX, or.ts
if they don't -
Use TypeScript's type system to catch errors early:
- Define interfaces for component props
- Use type annotations for state and variables
- Leverage TypeScript's built-in types and utility types
-
When converting existing components:
- Start by creating interfaces for the component's props
- Add type annotations for hooks and state
- Convert class components to functional components with proper typing
- Use React.FC type for functional components
-
Animation typing:
- Use proper types for react-spring animations
- Define interfaces for animation styles
- Type animated components appropriately
- Always define proper types for component props
- Use TypeScript's strict mode for better type safety
- Avoid using
any
type unless absolutely necessary - Create interfaces for reusable types in
src/types/portfolio.ts
- Utilize type inference when possible
- Use const assertions for static data objects
- Leverage union types for variant handling
- Add proper type declarations for external resources (images, etc.)
To convert remaining JavaScript components to TypeScript:
- Rename the file extension from
.js
to.tsx
for React components - Import necessary types from
src/types/portfolio.ts
- Add proper type annotations for props and state
- Use the TypeScript compiler to check for type errors:
npx tsc --noEmit
npm start
- Starts the development server with TypeScript supportnpm run build
- Builds the production bundle with TypeScript compilationnpm run test
- Runs tests with TypeScript supporttsc --noEmit
- Type checks the entire project without generating output files