You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * Unit create */exporttypeUnitCreateArgs<ExtArgsextends$Extensions.InternalArgs=$Extensions.DefaultArgs>={/** * Select specific fields to fetch from the Unit */select?: UnitSelect<ExtArgs>|null/** * Choose, which related nodes to fetch as well */include?: UnitInclude<ExtArgs>|null/** * The data needed to create a Unit. */data: XOR<UnitCreateInput,UnitUncheckedCreateInput>}
Especially data is interesting. It wants either UnitCreateInput xor UnitUncheckedCreateInput
And that's not what our generated types are.
How do we reproduce the bug?
I haven't created a minimal reproduction yet, but you at least need two prisma models where one model has a relation to the other. I don't know if there are more specific requirements than that to trigger the bug.
This might be enough of my schema to trigger the issue
I think I figured it out. I haven't verified this yet, but I guess we assume that id is autogenerated, and thus should not be supplied when doing "create". Or at least that it's optional. Which, if you look at my model, it isn't.
Confirmed that updating my prisma model to have this solved the red squiggle problem.
id String @id @default(uuid())
The issue is still valid though. We could do a better job generating our types to support ids with no default value
Tobbe
changed the title
[Bug]: Typegen: Generated service has errors for create resolver
[Bug]: Typegen: Generated service has errors for create resolver when the id in the db model has no default value
Mar 1, 2025
Tobbe
changed the title
[Bug]: Typegen: Generated service has errors for create resolver when the id in the db model has no default value
[Bug]: Typegen doesn't support id db fields without a default value
Mar 1, 2025
What's not working?
This is the generated code:
data
gets red squiggles.To dig a bit deeper in what's wrong you can do this to get better type info
What Prisma is expecting is this:
Especially
data
is interesting. It wants eitherUnitCreateInput
xorUnitUncheckedCreateInput
And that's not what our generated types are.
How do we reproduce the bug?
I haven't created a minimal reproduction yet, but you at least need two prisma models where one model has a relation to the other. I don't know if there are more specific requirements than that to trigger the bug.
This might be enough of my schema to trigger the issue
What's your environment? (If it applies)
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: