fix: resolve TS error in AboutMeContent - add CategoryKey type assertion for dynamic category access
This commit is contained in:
parent
9f06b1aa4c
commit
34243ff641
@ -15,8 +15,10 @@ const CATEGORIES = {
|
|||||||
"Architecture & Others": ["REST API", "TDD", "UI/UX Design", "Clean Architecture"],
|
"Architecture & Others": ["REST API", "TDD", "UI/UX Design", "Clean Architecture"],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type CategoryKey = keyof typeof CATEGORIES | "Other";
|
||||||
|
|
||||||
export default function AboutMeContent({ data }: AboutMeContentProps) {
|
export default function AboutMeContent({ data }: AboutMeContentProps) {
|
||||||
const categorizedSkills = {
|
const categorizedSkills: Record<CategoryKey, string[]> = {
|
||||||
"Core Tech": [],
|
"Core Tech": [],
|
||||||
"Backend & Tools": [],
|
"Backend & Tools": [],
|
||||||
"Architecture & Others": [],
|
"Architecture & Others": [],
|
||||||
@ -27,7 +29,7 @@ export default function AboutMeContent({ data }: AboutMeContentProps) {
|
|||||||
let matched = false;
|
let matched = false;
|
||||||
for (const [cat, skills] of Object.entries(CATEGORIES)) {
|
for (const [cat, skills] of Object.entries(CATEGORIES)) {
|
||||||
if (skills.some((s) => skill.title.toLowerCase().includes(s.toLowerCase()))) {
|
if (skills.some((s) => skill.title.toLowerCase().includes(s.toLowerCase()))) {
|
||||||
categorizedSkills[cat].push(skill.title);
|
categorizedSkills[cat as CategoryKey].push(skill.title);
|
||||||
matched = true;
|
matched = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user