fix: QueryResultRow-Constraint für db.query<T> unter TypeScript strict

This commit is contained in:
2026-04-17 08:24:15 +00:00
parent 506197623a
commit ad0febe2cf

View File

@@ -1,9 +1,9 @@
import { Pool } from 'pg'
import { Pool, type QueryResultRow } from 'pg'
const pool = new Pool({ connectionString: process.env.DATABASE_URL })
export const db = {
execute: (sql: string) => pool.query(sql),
query: <T = Record<string, unknown>>(sql: string, params: unknown[]) =>
query: <T extends QueryResultRow = Record<string, unknown>>(sql: string, params: unknown[]) =>
pool.query<T>(sql, params).then((r) => r.rows),
}