prisma: [5.9.0 Bug] `Prisma.TransactionClient` appears to be missing types

Bug description

image

How to reproduce

Update client to latest 5.9.0 and rerun prisma generate

Expected behavior

No response

Prisma information

// Add your schema.prisma
// Add your code using Prisma Client

Environment & setup

  • OS:
  • Database:
  • Node.js version:

Prisma Version

prisma                  : 5.9.0
@prisma/client          : 5.9.0
Computed binaryTarget   : darwin-arm64
Operating System        : darwin
Architecture            : arm64
Node.js                 : v20.11.0
Query Engine (Node-API) : libquery-engine 23fdc5965b1e05fc54e5f26ed3de66776b93de64 (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Schema Engine           : schema-engine-cli 23fdc5965b1e05fc54e5f26ed3de66776b93de64 (at node_modules/@prisma/engines/schema-engine-darwin-arm64)
Schema Wasm             : @prisma/prisma-schema-wasm 5.9.0-32.23fdc5965b1e05fc54e5f26ed3de66776b93de64
Default Engines Hash    : 23fdc5965b1e05fc54e5f26ed3de66776b93de64
Studio                  : 0.497.0

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Reactions: 9
  • Comments: 18 (12 by maintainers)

Commits related to this issue

Most upvoted comments

This currently causes no issues for me

// tsconfig.json
{
  "compilerOptions": {
    "lib": [
      "ESNext",
      "DOM"
    ],
    "esModuleInterop": true,
    "noUnusedLocals": false
  }
}

Okay, yeah, on adding

To clarify, this also affects node16 and nodenext as well, not just bundler

 "moduleResolution": "bundler",
 "module": "esnext",

I can confirm the lack of types šŸ‘

image

indirection is not relevant image

I can confirm that 5.10.0-integration-fix-nodenext.2 works on my codebase, both in terms of type checking and the runtime.

just change ā€œmoduleResolutionā€ to ā€œnodeā€, works fine for me

https://github.com/prisma/prisma/releases/tag/5.9.1 is now available with the fix ✨

Please create a new issue if you find a bug.

My issue is still present even with 5.10.0-integration-fix-nodenext.2, I will create a reproduction later today

@pheuter We are investigating this, we want to fix this in a patch release. We’ll keep you updated, and thanks for the report!

In the meantime, stay on 5.8.1, until we release 5.9.1

I understand that changing moduleResolution works, but that shouldn’t be required, and works fine with moduleResolution: "bundler" for Prisma 5.8.1. The latest version of SvelteKit requires moduleResolution: "bundler".

Can also confirm that this causes types to be picked up for me 😃

"moduleResolution": "node",
"module": "esnext"

I’ll reopen this for now. We will close it once we have the patch published on npm as 5.9.1 later.

I have no (a very minimal) tsconfig.json in my local repro set up but I can immediately say that just switching from postgres to mongodb makes no difference to the generated types. I’ll try with the tsconfig now šŸ‘

We use functions that add some indirection, so we have code like the following:

import type { Prisma } from '@prisma/client';

export async function createEmployees(txn: Prisma.TransactionClient) {
  // ...
}

Can you confirm that the types still work when directly typing via Prisma.TransactionClient instead of letting the types flow from a prisma.$transaction() call?

/cc @Druue