Repository navigation
Replies: 1 comment
|
The generated To get the exact TypeScript type that reflects your omitted fields, use import { Prisma } from '@prisma/client';
export type UserWithoutPassword = Prisma.UserGetPayload<{
omit: { password: true };
}>;If you configured the omit globally through export type User = NonNullable<Awaited<ReturnType<typeof prisma.user.findUnique>>>;Using |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Question
We are using the new omitApi in our project to global omit the password from the user.
We also use the generated User type from the Prisma type exports.
That causes issues because the type is generated before creating the client, so it still includes the password field.
Is there any way to get the type of the model after omitting, i.e. as if calling the findFirst method of the user, without resorting to workarounds like ReturnType?
THX!
All reactions