-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prisma 5 - incompatible type for cursor property #406
Comments
Can you share related part of your Prisma schema? |
This is the relevant section
|
I have the same error for any model though, so I don't think it's related to this in particular |
I've encountered this for models with multi-columns unique indexes. This breaks TS typings because in Prisma 5.0 they use a TS trick to check if user provides either a primary key or the unique combination of fields. However, in GraphQL we can't enforce such constraints, so it now yells in compile-time that something is wrong. |
I see. Any workaround we can put in place? I guess I can omit 'cursor' from my type, but this is not a global solution. Maybe the type of cursor should be |
related to this? prisma/prisma#20619 |
We're seeing this with a model with only one unique field: model RedactedModelName {
id String @id @default(uuid())
redactedId String
redactedField RedactedField @relation(fields: [redactedId], references: [id])
userId String
user User @relation(fields: [userId], references: [id])
reasonId String
reason DisputedReason @relation(fields: [reasonId], references: [id])
createdAt DateTime @default(now()) @db.Timestamptz
updatedAt DateTime @updatedAt @db.Timestamptz
status Status @default(OPEN)
notes String?
} The generated I've added a hack around this for now: export type TypegraphqlWorkAround<T> = T & { cursor?: any }; and then just declare/assert with: TypegraphqlWorkAround<FindManyRedactedModelNameArgs> |
Describe the Bug
With the new prisma 5 version the type produced by code generation is wrong for the
cursor
type.This only happens with cursor, not the other properties. In the image below
FindManyCaptionArgs
comes from the type in the generate filepackages/prisma/dist/@generated/resolvers/crud/Caption/args/FindManyCaptionArgs.d.ts
To Reproduce
Try to use the types generated from the package for find operations
Expected Behavior
The type should match
Logs
Environment (please complete the following information):
typegraphql-prisma
0.27.0The text was updated successfully, but these errors were encountered: