fix: add QueryResultRow constraint to db query generic

pg's Pool.query<T> requires T extends QueryResultRow. Added the
constraint and imported the type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
AJ Avezzano
2026-04-01 11:28:38 -04:00
parent 986f30d8cc
commit 6de0d98dee

View File

@@ -1,4 +1,4 @@
import { Pool, PoolClient, QueryResult } from "pg";
import { Pool, PoolClient, QueryResult, QueryResultRow } from "pg";
// ─── Connection pool ──────────────────────────────────────────────────────────
@@ -26,7 +26,7 @@ function getPool(): Pool {
// ─── Query helpers ────────────────────────────────────────────────────────────
export async function query<T = Record<string, unknown>>(
export async function query<T extends QueryResultRow = Record<string, unknown>>(
text: string,
params?: unknown[]
): Promise<QueryResult<T>> {