From 34243ff6415a1771bd295e56c3948445c604a044 Mon Sep 17 00:00:00 2001 From: DevOps Date: Sun, 28 Jun 2026 17:22:18 +0000 Subject: [PATCH] fix: resolve TS error in AboutMeContent - add CategoryKey type assertion for dynamic category access --- .../components/aboutMe/AboutMeContent.tsx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/app/(routes)/(website)/components/aboutMe/AboutMeContent.tsx b/src/app/(routes)/(website)/components/aboutMe/AboutMeContent.tsx index 71a72c9..a5bfa14 100644 --- a/src/app/(routes)/(website)/components/aboutMe/AboutMeContent.tsx +++ b/src/app/(routes)/(website)/components/aboutMe/AboutMeContent.tsx @@ -15,8 +15,10 @@ const CATEGORIES = { "Architecture & Others": ["REST API", "TDD", "UI/UX Design", "Clean Architecture"], }; +type CategoryKey = keyof typeof CATEGORIES | "Other"; + export default function AboutMeContent({ data }: AboutMeContentProps) { - const categorizedSkills = { + const categorizedSkills: Record = { "Core Tech": [], "Backend & Tools": [], "Architecture & Others": [], @@ -27,7 +29,7 @@ export default function AboutMeContent({ data }: AboutMeContentProps) { let matched = false; for (const [cat, skills] of Object.entries(CATEGORIES)) { if (skills.some((s) => skill.title.toLowerCase().includes(s.toLowerCase()))) { - categorizedSkills[cat].push(skill.title); + categorizedSkills[cat as CategoryKey].push(skill.title); matched = true; break; } @@ -38,12 +40,12 @@ export default function AboutMeContent({ data }: AboutMeContentProps) { const isRTL = typeof document !== "undefined" && document.dir === "rtl"; return ( -
{/* Text Section */} - {data.description}

- +
{Object.entries(categorizedSkills).map(([category, skills]) => ( skills.length > 0 && ( -
{skills.map((skill, idx) => ( - {skill} @@ -88,7 +90,7 @@ export default function AboutMeContent({ data }: AboutMeContentProps) { {/* Image Section */} -