@unthrown/prisma: export a transaction-client type helper (TxDenyList is internal)
Context
Naming the tx parameter in a helper's signature — anything factored out of a $tryTransaction callback — requires spelling out the transaction client type. TxDenyList exists in the package but is not exported:
// dist/index.d.mts
type TxDenyList = "$connect" | "$disconnect" | "$on" | "$transaction" | "$use" | "$extends" | "$tryTransaction";
export { type CursorPaginationMeta, type CursorPaginationOptions, CursorPaginator, ForeignKeyViolation,
InvalidCursor, PrismaQueryError, RecordNotFound, TransactionIsolationLevel,
UniqueConstraintViolation, qualifyPrismaError, unthrownPrisma };
Deriving it from the method signature does not work either: Parameters<Parameters<PrismaService["$tryTransaction"]>[0]>[0] degrades to Omit<unknown, …>, because the signature is $tryTransaction<C, …>(this: C, …) and C is unresolved at that position.
So every adopting service hand-copies the deny list:
type PrismaTransactionClient = Omit<
PrismaService,
| "$connect" | "$disconnect" | "$extends" | "$on"
| "$transaction" | "$tryTransaction" | "$use"
>;
Why it matters
It is duplicated per service (we have it in more than one already), and it is a literal copy of a list the library owns. If the deny list ever changes — say nesting becomes supported, or a new client method is excluded — every copy silently drifts and keeps compiling, since Omit of a non-existent key is not an error.
Suggestion
Either export TxDenyList, or better, export the applied helper so consumers never restate the list:
export type TransactionClient<C> = Omit<C, TxDenyList>;
// usage: type Tx = TransactionClient<PrismaService>;
The second reads better at call sites and keeps the deny list entirely internal, which seems to be the intent.
Found while migrating service-lease (Millenium) to unthrown; the same alias already exists in service-lease-accounting.