From 808df775a4821db7ec796d5d87949763e3c94bd8 Mon Sep 17 00:00:00 2001 From: Hikari Date: Fri, 20 Feb 2026 00:02:11 -0800 Subject: [PATCH] fix: correct TypeScript types in ActivityService Fixed two type errors: - Changed ActivityType assertions from 'as ActivityType' to 'as const' for proper literal type inference - Changed achievement.name to achievement.title to match the actual AchievementDefinition structure This ensures type safety and proper union type discrimination. --- api/src/app/services/activity.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/src/app/services/activity.service.ts b/api/src/app/services/activity.service.ts index ef17c02..28a9941 100644 --- a/api/src/app/services/activity.service.ts +++ b/api/src/app/services/activity.service.ts @@ -89,7 +89,7 @@ export class ActivityService { return suggestions.map((suggestion) => ({ id: `suggestion-${suggestion.id}`, - type: "SUGGESTION" as ActivityType, + type: "SUGGESTION" as const, user: suggestion.user as ActivityUser, entityType: suggestion.entityType, suggestionTitle: suggestion.title, @@ -139,7 +139,7 @@ export class ActivityService { ); return { id: `like-${like.id}`, - type: "LIKE" as ActivityType, + type: "LIKE" as const, user: like.user as ActivityUser, entityType: like.entityType, entityId: like.entityId, @@ -229,7 +229,7 @@ export class ActivityService { return { id: `comment-${comment.id}`, - type: "COMMENT" as ActivityType, + type: "COMMENT" as const, user: comment.user as ActivityUser, entityType, entityId, @@ -282,10 +282,10 @@ export class ActivityService { const achievement = ACHIEVEMENTS[ua.achievementKey]; return { id: `achievement-${ua.id}`, - type: "ACHIEVEMENT" as ActivityType, + type: "ACHIEVEMENT" as const, user: ua.user as ActivityUser, achievementKey: ua.achievementKey, - achievementName: achievement.name, + achievementName: achievement.title, achievementIcon: achievement.icon, achievementPoints: achievement.points, createdAt: ua.earnedAt!,