MichalLytek / MichalLytek/typegraphql-prisma
Prisma 5 - incompatible type for cursor property
- Dominant language
- TypeScript
- Stars
- 918
- Forks
- 130
- PR merge metrics
- No merged PRs in 30d
Description
**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 file `packages/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**
```
Type 'import("[...]@generated/resolvers/inputs/CaptionWhereUniqueInput").CaptionWhereUniqueInput | undefined' is not assignable to type 'import("[...]/node_modules/.pnpm/@prisma+client@5.0.0_prisma@5.0.0/node_modules/.prisma/client/index").Prisma.CaptionWhereUniqueInput | undefined'.
Type 'CaptionWhereUniqueInput' is not assignable to type 'CaptionWhereUniqueInput | undefined'.
Type 'CaptionWhereUniqueInput' is not assignable to type '{ id: string | CaptionProjectIdInterimIdTargetLanguageCompoundUniqueInput; projectId_interimId_targetLanguage: string | CaptionProjectIdInterimIdTargetLanguageCompoundUniqueInput; } & { ...; }'.
Type 'CaptionWhereUniqueInput' is not assignable to type '{ id: string | CaptionProjectIdInterimIdTargetLanguageCompoundUniqueInput; projectId_interimId_targetLanguage: string | CaptionProjectIdInterimIdTargetLanguageCompoundUniqueInput; }'.
Types of property 'id' are incompatible.
Type 'string | undefined' is not assignable to type 'string | CaptionProjectIdInterimIdTargetLanguageCompoundUniqueInput'.
Type 'undefined' is not assignable to type 'string | CaptionProjectIdInterimIdTargetLanguageCompoundUniqueInput'.ts(2322)
````
**Environment (please complete the following information):**
- OS: MacOS
- Node: 18
- `typegraphql-prisma` 0.27.0
- Prisma version 5.0.0
- TypeScript version 4.9.5
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the find operation with Prisma 5 and inspect packages/prisma/dist/@generated/resolvers/crud/Caption/args/FindManyCaptionArgs.d.ts alongside the generated CaptionWhereUniqueInput type. Trace how the cursor type is generated and compare it with Prisma.Client's CaptionWhereUniqueInput. Done means generated cursor types are assignable to the Prisma 5 client type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100