Yamanlk / transactional-prisma

"@transactional/prisma" is an npm package that offers a "@Transactional" method decorator for running your queries inside a transaction seamlessly. It achieves this by leveraging AsyncLocalStorage.
9 stars 0 forks source link

Prisma type error #3

Open revmischa opened 2 months ago

revmischa commented 2 months ago
import { prismaTransactional } from "@transactional/prisma";

const prisma = new PrismaClient(opts).$extends(prismaTransactional)

Error:

core/src/db/client.ts:13:3 - error TS2739: Type 'DynamicClientExtensionThis<TypeMap<InternalArgs & { result: {}; model: {}; query: {}; client: {}; }, PrismaClientOptions>, TypeMapCb, { result: {}; model: {}; query: {}; client: {}; }, {}>' is missing the following properties from type 'PrismaClient<PrismaClientOptions, never, DefaultArgs>': $on, $use

13   return new PrismaClient(opts).$extends(prismaTransactional)
     ~~~~~~

Using Prisma 5.16.1

BTW in the docs it says:

import { prismaTransactional } from "@transactional/prisma";

const prisma = new PrismaClient().$extends(extension);

But I think that should be $extends(prismaTransactional);