Skip to content

Prisma silently loses nested query type safety on TypeScript ≥ 6.0 #30190

Description

@flololan

Package and version

prisma@^7.1.9

What happened?

Related to #29519, but this issue is about a distinct problem: Prisma does not declare, enforce, or warn about its supported TypeScript version range, even though TS ≥ 6.0 is known to silently disable excess property checking for nested select / include / where / data arguments.

The combination is dangerous:

So a routine typescript dependency bump — something Renovate/Dependabot does automatically — silently downgrades the type safety of every Prisma query in the codebase, with zero feedback to the developer. In our codebase this hid real errors (verified by re-checking with TS 5.9.2) that all surface as runtime errors.

Severity assessment

We'd argue this is critical, not a papercut: it's a silent, global loss of the guarantee Prisma is built around, triggered by a dependency update that no tooling flags. Even if the full fix for #29519 takes time, the guard/warning above is cheap and would protect every team upgrading TypeScript today.

Co-authored-by: @AlexDieRobbe

What did you expect to happen?

One or more of:

  1. @prisma/client declares peerDependencies: { "typescript": ">=5.1.0 <6.0.0" } (with peerDependenciesMeta optional for pure-JS users), so package managers warn on install.
  2. prisma generate detects the installed TypeScript version and prints a prominent warning (or fails with --strict) when it is in a known-broken range.
  3. The documentation and release notes clearly state that TS ≥ 6.0 is currently unsupported for full type safety.

Minimal reproduction

  1. prisma@7.x + typescript@6.x

  2. Any query with a nonexistent field in a nested select, e.g.

    prisma.user.findMany({ select: { id: true, posts: { select: { doesNotExist: true } } } })
  3. tsc --noEmit → no error. Runtime → PrismaClientValidationError.

  4. Same code with typescript@5.9.2 → compile error as expected.

Environment

  • Prisma: 7.9.1
  • TypeScript: 6.0.3 (also reproduced on 7.0.2)
  • Node: 26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions