How to make a library/package that expects a Prisma client with a certain schema?

Hi, I'm currently trying to make it so I have my Prisma Schema as a private GitHub package that I can consume in various environments and projects, using the new prisma-client generator, which expects an output path. I have my package called @blabla/prisma-client, which exports all Prisma types from the generated client (e.g ./generated/client), after having been built with tsc, to output .d.ts files, which are all I really care about, to use in different projects. I import that package into my modules which accept a Prisma Client on initialization, to use its types, and then I export my functions and classes for consumption in a different project. I figured out I can use an environment variable using env() within the Prisma Schema to dynamically set where I want my generated output to be. The issue that I am having now, is that I get an error when calling my library's function (which accepts a Prisma Client with the type coming from the compiled .d.ts code) with the generated Prisma Client (from the raw .ts code). I've attached it to the post. I assume I can probably bypass it with an as any. But that seems very dirty, and at that point I am pretty certain I am making some sort of mistake? Is there a better way to do this...?
No description
1 Reply
Prisma AI Help
You chose to debug with a human. They'll tinker with your query soon. If you get curious meanwhile, hop into #ask-ai for a quick spin!

Did you find this page helpful?