Problem
server/composables/users.ts has a @ts-expect-error suppressing a type mismatch between the API response and the shared state type.
Current state:
export const fetchUsers = async () => {
const users = useUsers();
const newValue = await $dropFetch("/api/v1/admin/users");
// @ts-expect-error: API returns authMecs without `id`, but state type requires it
users.value = newValue;
return newValue;
};
The useUsers() state type requires authMecs entries with { id: string; mec: AuthMec }, but the /api/v1/admin/users API response intentionally omits id.
Impact
- Every
useUsers() consumer is exposed to missing runtime data
- The
@ts-expect-error hides a real incompatibility
- Type safety is compromised for the admin users feature
Proposed Solutions
Option A (recommended): Normalize the API response by generating/assigning id during fetchUsers before storing in state.
Option B: Update the shared state type and all consumers to match the actual API payload (without id).
Option C: Update the API endpoint to include id in the response.
Context
Acceptance Criteria
Problem
server/composables/users.tshas a@ts-expect-errorsuppressing a type mismatch between the API response and the shared state type.Current state:
The
useUsers()state type requiresauthMecsentries with{ id: string; mec: AuthMec }, but the/api/v1/admin/usersAPI response intentionally omitsid.Impact
useUsers()consumer is exposed to missing runtime data@ts-expect-errorhides a real incompatibilityProposed Solutions
Option A (recommended): Normalize the API response by generating/assigning
idduringfetchUsersbefore storing in state.Option B: Update the shared state type and all consumers to match the actual API payload (without
id).Option C: Update the API endpoint to include
idin the response.Context
server/composables/users.ts:22-24/api/v1/admin/usersAcceptance Criteria
@ts-expect-errorremoved fromfetchUsersuseUsers()consumers work correctly with the resolved type