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:
@@ -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>> {
|
||||
|
||||
Reference in New Issue
Block a user