docs icon indicating copy to clipboard operation
docs copied to clipboard

Docs for advanced type safety incorrect

Open timsuchanek opened this issue 4 years ago • 2 comments

Bug description

https://www.prisma.io/docs/concepts/components/prisma-client/advanced-type-safety#importing-generated-types

image

The whole docs page is doing explicit type casts. Those will however lose the type information. The example in the screenshot is additionally incorrect. When only querying posts, you'd have profile only.

We used to have some utility types for these cases. @millsp probably knows where we have them.

How to reproduce

Expected behavior

No response

Prisma information

Environment & setup

  • OS:
  • Database:
  • Node.js version:

Prisma Version


timsuchanek avatar Aug 19 '21 14:08 timsuchanek

Hey @timsuchanek ! Hmm, I tested this and you do get both profile and posts in the userPosts type:

prisma-typescript

I'll chat with @millsp though 😀

molebox avatar Aug 24 '21 12:08 molebox

cc @andrew-walford-prisma @tanberry

millsp avatar Jun 08 '22 18:06 millsp