Skip to content

Types not exposed properly in monorepo with prisma-client provider #27600

Closed as not planned

Description

@davidthor

Bug description

I have a monorepo using pnpm that matches the setup from this example:

https://github.com/prisma/prisma-examples/tree/latest/generator-prisma-client/nextjs-starter-webpack-monorepo

However, types aren't exported from the peer package when being used in the consuming package - even in the official prisma example shown above. The client functions correctly and returns results, but the exported client is simply of type "any", which is a major nuisance when authoring code with the client.

I've tried importing directly from the dist folder from within the prisma package in the repo and the types are correct when doing intra-package imports. The issue is only when importing from a sibling package within the monorepo. I suspect that makes this a typescript issue, but I don't know how to resolve it and would love for the example project to be updated correctly.

Severity

🔹 Minor: Unexpected behavior, but does not block development

Reproduction

  1. Clone the prisma-examples repo
  2. cd generator-prisma-client/nextjs-starter-webpack-monorepo
  3. pnpm install && pnpm run build
  4. Open packages/next-app/lib/utils/query.ts inside your IDE, hover over the prisma import and observe that it has a type of "any"

Expected vs. Actual Behavior

Expected proper types on prisma client exported from monorepo package, but getting "any" instead.

Frequency

Consistently reproducible

Does this occur in development or production?

Only in development (e.g., CLI tools, migrations, Prisma Studio)

Is this a regression?

No

Workaround

No workaround, but the client behaves as expected despite the types not being exported correctly.

Prisma Schema & Queries

import prisma from '@/lib/db'

export const getQuotes = async () => {
  const start = Date.now()

  // `prisma` is of type "any" so there's no completions for these methods or the response
  const result = await prisma.quotes.findMany({
    orderBy: {
      id: 'desc',
    },
    take: 1,
  })

  return {
    data: result,
  }
}

export const addQuote = async (quote: string) => {
  // Same here
  return await prisma.quotes.create({
    data: {
      quote,
    },
  })
}

Prisma Config

// See: https://www.prisma.io/docs/orm/prisma-schema/overview/generators#field-reference-1
generator client {
  provider = "prisma-client"
  output = "../src/generated/prisma"
  previewFeatures = ["driverAdapters", "queryCompiler"]
}

Logs & Debug Info

// Debug logs here

Environment & Setup

  • OS: macOS
  • Database: PostgreSQL
  • Node.js version: 22.16.0

Prisma Version

6.11.1

Activity

  1. added
    kind/bug
    on Jul 5, 2025
  2. self-assigned this
    on Jul 8, 2025
  3. added
    bug/1-unconfirmed
    on Aug 1, 2025
  4. FGoessler commented on Aug 6, 2025

    @FGoessler
    Contributor

    Hi @davidthor 👋

    I was not able to reproduce your issue with the current setup other than by NOT generating the client code in the first place. Can you please check back how it behaves with the latest versions of Prisma (6.13.0) and ensuring that the generated code is up to date and your prisma and @prisma/client versions are in sync?

  5. jkomyno commented on Aug 6, 2025

    @jkomyno
    Contributor

    I also can't reproduce this:

    Image

    Please double check the following files in your project, and compare them with our examples to see if there's something missing in your project:

    • package.json in the package containing your Prisma definitions
    • tsconfig.json files referenced by your monorepo
  6. jkomyno commented on Aug 17, 2025

    @jkomyno
    Contributor

    We're closing this issue for inactivity. It is not reproducible in its current state anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug/1-unconfirmedkind/bugtopic: generator-ts

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions