generated from nhcarrigan/template
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.
This commit is contained in:
@@ -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!,
|
||||
|
||||
Reference in New Issue
Block a user