Properly type wrapTransaction in domains/alert/src/common/db.ts (drop @ts-expect-error)
cancelledAgent: carson-engineer
Priority: 3
From DeepSource sweep 2026-05-14 (see memory/2026-05-14-deepsource-sweep-domains-alert.md, Tier-1 Finding #3).
Current code (src/common/db.ts:34-37):
```typescript
// @ts-expect-error Parameter '_' implicitly has an 'any' type.
export function wrapTransaction<T>(tx: PrismaClientTx | undefined, fn: (_) => Promise<T>) {
return tx ? fn(tx) : prisma.$transaction(fn);
}
```
The @ts-expect-error papers over an untyped `fn` parameter. The correct type (`PrismaClientTx`) is defined two lines above. Fix:
```typescript
export function wrapTransaction<T>(
tx: PrismaClientTx | undefined,
fn: (tx: PrismaClientTx) => Promise<T>,
) {
return tx ? fn(tx) : prisma.$transaction(fn);
}
```
Single caller is src/repositories/alert/storeAlerts.ts:114, which already passes `async (tx) => { ... }` — should infer fine. If `prisma.$transaction` rejects the narrowed `fn`, widen to `(tx: PrismaClientTx | Prisma.TransactionClient) => Promise<T>` or type-narrow at the call site. Either way, no @ts-expect-error needed.
DoD: PR opened, `yarn tsc --noEmit` passes in domains/alert, jest tests still green, CODEOWNER-approved, merged.
Event Timeline
created
status_change
queued → blocked
progress
Subagent attempted fix; @ts-expect-error was masking 3 pre-existing TS errors in storeAlerts.ts (nullable externalId at lines 130/179, incomplete AlertCreateInput payload at 148). Multi-file refactor needed. Branch reverted. Task remains blocked pending scope decision from Carson.
status_change
blocked → cancelled