Skip to content

fix(postgres-js): widen PostgresJsSession constraint for TransactionSql#5407

Open
YevheniiKotyrlo wants to merge 1 commit into
drizzle-team:mainfrom
YevheniiKotyrlo:fix/postgres-js-session-transaction-constraint
Open

fix(postgres-js): widen PostgresJsSession constraint for TransactionSql#5407
YevheniiKotyrlo wants to merge 1 commit into
drizzle-team:mainfrom
YevheniiKotyrlo:fix/postgres-js-session-transaction-constraint

Conversation

@YevheniiKotyrlo
Copy link
Copy Markdown

Summary

Widen PostgresJsSession's generic constraint from TSQL extends Sql to TSQL extends Sql | TransactionSql.

Problem

Since postgres@3.4.8, TransactionSql extends Omit<Sql, 'reserve'> instead of Sql. The transaction() method creates new PostgresJsSession<TransactionSql, ...>, but TransactionSql no longer satisfies TSQL extends Sql, producing TS2344.

This affects users regardless of skipLibCheck — any direct use of PostgresJsSession with the postgres package at v3.4.8+ triggers the error.

Fix

 export class PostgresJsSession<
-  TSQL extends Sql,
+  TSQL extends Sql | TransactionSql,

The union is backward-compatible: on older postgres versions where TransactionSql extends Sql, the | TransactionSql is redundant but harmless.

Related: #5187

@YevheniiKotyrlo YevheniiKotyrlo force-pushed the fix/postgres-js-session-transaction-constraint branch from 0cb7fa5 to 4e12388 Compare April 9, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant