This repository has been archived by the owner on Jan 14, 2021. It is now read-only.
Type Generation : returned payload type on upsert not using include #660
Labels
bug/2-confirmed
We have confirmed that this is a bug.
kind/regression
A reported bug in functionality that used to work before.
tech/typescript
Issue for tech TypeScript.
Milestone
Breaking commit: prisma/prisma@4cee929#diff-55d3b6703244dc96a4a668b570e5c70d
^^ Issue is caused by the above commit, related to prisma/prisma#615. There is not explanation given as to why this change was made. @timsuchanek could you clarify this change?
Bug description
The
include
option only expands the result type when the query options passed to the Prisma Client extend thefindMany
options.The following line decides when
includes
will expand the return type:https://github.com/prisma/prisma/blob/c86af74877d9f39936b18276b3c1db8d5ff7b310/src/packages/client/src/generation/TSClient.ts#L553
How to reproduce
Add includes to an
upsert
, orfindOne
that uses awhere
with a composite unique lookup, that is not available in{...}WhereInput
.Using the blog fixture example:
typeof like
isLike
despite the includes.Expected behavior
The type correctly has the fields specified in
includes
.In the above example,
typeof like
should beLike & {post: Post}
.Prisma information
Example in https://github.com/squirly/prisma/tree/bug-example/src/packages/client/fixtures/blog
Environment & setup
The text was updated successfully, but these errors were encountered: