Using Prisma.XyzFindManyArgs
breaks findMany
typing in v4.16.0+
#20093
Labels
bug/1-unconfirmed
Bug should have enough information for reproduction, but confirmation has not happened yet.
kind/bug
A reported bug.
team/client
Issue for team Client.
tech/typescript
Issue for tech TypeScript.
topic: client types
Types in Prisma Client
topic: clientExtensions
topic: findMany()
topic: prisma-client
Milestone
Bug description
We sometimes generate find options dynamically and use the
Prisma.UserFindManyArgs
type for this, e.g. in a case like this:Starting with Prisma v4.16.0, the code above throws a typing error:
TS2339: Property 'userRoles' does not exist on type [...]
. I think this is probably caused by the new typing because of client extensions - but in my opinion, the code above should still work.As a workaround, it's possible to write a custom type for
userFindManyArgs
, e.g.const userFindMany: { where?: Prisma.UserWhereInput; take?: number } = {};
, but that's only a workaround for a breaking change.How to reproduce
Use the code above, check if
users[0].userRoles
throws a typescript error.Expected behavior
Same behavior as before - adding an include should always include the relations in the result typing.
Prisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: