-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
Bug description
Let's take an example model:
model Invitee {
id Int @id @default(autoincrement())
email String
firstName String
lastName String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}This generates the following Where Input:
export type InviteeWhereInput = {
AND?: XOR<InviteeWhereInput, Enumerable<InviteeWhereInput>>
OR?: XOR<InviteeWhereInput, Enumerable<InviteeWhereInput>>
NOT?: XOR<InviteeWhereInput, Enumerable<InviteeWhereInput>>
id?: XOR<IntFilter, number>
email?: XOR<StringFilter, string>
firstName?: XOR<StringFilter, string>
lastName?: XOR<StringFilter, string>
createdAt?: XOR<DateTimeFilter, Date | string>
updatedAt?: XOR<DateTimeFilter, Date | string>
}Now consider the following code example:
const conditions: Prisma.InviteeWhereInput[] = [];
conditions.push({
OR: [
{ sdad: 1 },
{ firstName: { contains: filter.search, mode: 'insensitive' } },
{ lastName: { contains: filter.search, mode: 'insensitive' } },
{ email: { contains: filter.search, mode: 'insensitive' } },
],
});One would expect the first object of the OR to be rejected by typescript, but it is not.
Expected behavior
If we remove the XOR from the OR and replace that with OR?: InviteeWhereInput | Enumerable<InviteeWhereInput>, we get back the error in typescript. This leads me to believe that the current XOR is broken.
Prisma information
v2.12.1
Reactions are currently unavailable