prisma-nestjs-graphql: Prisma 5 released - breaks generated types
It looks like the changes introduced in V5 of Prisma break the generated files from this. Lots of * is not assignable to type *
type errors. I guess it’s because of the changes to carry shortcuts, but it might be something else. I’ve tried searching through, but I got in a bit of looping trying to find the exact reason.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 3
- Comments: 19 (4 by maintainers)
Links to this issue
Commits related to this issue
- feat(compatibility): New configuration option `unsafeCompatibleWhereUniqueInput` close: #177 — committed to unlight/prisma-nestjs-graphql by unlight 9 months ago
- feat(compatibility): New configuration option `unsafeCompatibleWhereUniqueInput` close: #177 — committed to unlight/prisma-nestjs-graphql by unlight 9 months ago
- chore(release): 19.2.0 [skip ci] ## [19.2.0](https://github.com/unlight/nestjs-graphql-prisma/compare/v19.1.0...v19.2.0) (2023-09-23) ### Features * **compatibility:** New configuration option `uns... — committed to unlight/prisma-nestjs-graphql by semantic-release-bot 9 months ago
- chore(release): 1.0.0 [skip ci] ## 1.0.0 (2024-03-20) ### ⚠ BREAKING CHANGES * Bump version * Update packages * Require `@prisma/client` v4.12+ Must be used with optional dependency `prisma-graphql... — committed to resident-advisor/prisma-nestjs-graphql by semantic-release-bot 3 months ago
@unlight Unfortunately, I’m still getting errors in any
WHere
class with anAND
etc., as they are self-references and, therefore, not wrapped with thePrisma.AtLeast
. So we need to also add it to those.I think the issue is that we are wrapping the
where: Prisma.AtLeast<SomeCLasseUniqueInput, 'id'>;
instead of the actual type like Prisma does.@jasonmacdonald @magrinj @Siumauricio Please check version 19 (use next dist-tag) with prisma 5
It looks like they are now wrapping certain types in a
Prisma.AtLeast<{...classProps}, "prop1" | "prop1">
function which makes certain properties required if they are, I assume,@id
,@@id
or@unique
in the schema.EDIT: Narrowed it down to any
WhereUniqueInput
class. they are all wrapped in this condition now.@unlight Thx for you response. I’ll try type assertion, but it’s a bit messy in the code. I’m in for a switch in the configuration even if it is a bit unsafe.
Another idea - introduce new option in config to trick typescript and add exclamation mark for all unique fields for such WhereUniqueInput classes (unsafe, needs validation and coercing to valid type).
Can confirm that v19.0.0 works as expected.