hi !! I wonder why the type inference of User typ...
# orm-help
y
hi !! I wonder why the type inference of User type is different in the two case below.
👀 1
r
Because the type in the first is
Prisma.UserSelect
so TypeScript cannot infer the actual values. In the second one, you have specified the exact value. Remove
Prisma.UserSelect
from the first and it both will behave the same.
👍 1
y
thanks to reply !!
Remove 
Prisma.UserSelect
 from the first and it both will behave the same.
cannot remove Prisma.UserSelect because select is declared outside, and need define a type.
Prisma.UserSelect
 so TypeScript cannot infer the actual values.
I dont’t quite understand what you mean. the only thing i did defined the select variable used for prisma api and specify the type. 🤔 our team often declares the value used for the prisma client api externally as in the case above.
👍 1
r
This is actually what you would need to add and not
Prisma.UserSelect
. The
UserSelect
is a broad type and TypeScript cannot narrow it down to what you have added in as values.
😃 2
prisma rainbow 2
😍 2
👍 2
y
🥁 🎺 wowww!! It works what I expected !!!! thx !!
👏 2
fast parrot 2