Baptiste Marchand
PPrisma
•Created by Baptiste Marchand on 8/22/2024 in #help-and-questions
Native types for enums
Hi,
I would like to add a native type to an enum field. Like that :
But when I do a
prisma generate
I get the following error : Attribute not known: "@db.VarChar".
Are native types supported for enums?5 replies
PPrisma
•Created by Baptiste Marchand on 6/6/2024 in #help-and-questions
Adding fields to a templated `select`
Hi,
Let's say I have a
getUser
function, which takes a select
as its argument :
Now I want to add a log that says which user I'm getting, so I try this :
But now I have the following TypeScript error: Type 'T & { id: true; }' is not assignable to type 'T & { id: true; }'. Two different types with this name exist, but they are unrelated.
So I found the workaround of creating a variable for the select :
That gets rid of the previous error, but I still have an error on the user.id
: Property 'id' does not exist on type GIANT_TYPESCRIPT_TYPE
.
Is there a workaround for this? Adding fields to a templated select is a use-case that came up a few times already in my codebase so I'm trying to find a proper solution (right now we just slap an any
on there).
Thank you5 replies