In route/controller code, don’t rely on repeated as casts to satisfy TypeScript—normalize/validate types once, then keep the rest of the logic strongly typed.

Apply this style rule:

Example (mimic the proposed approach):

// Normalize once to the correct element shape
const normalizeChallenges = (arr: unknown) => arr as Array<{ id: string }>;

const filteredCompletedChallenges = normalizeChallenges(user.completedChallenges)
  .filter(c => !challengeIdsToReset.includes(c.id));

await fastify.prisma.user.update({
  where: { id: req.user!.id },
  data: {
    completedChallenges: filteredCompletedChallenges,
  },
});