antoine
PPrisma
•Created by antoine on 1/29/2025 in #help-and-questions
Typing Prisma and how write "or" and a named type (prisma ORM/mongodb)
Hello i would like to know how can i write or typed that with Prisma (mongodb DB). I don't know how to write 'or' with Prisma or a named value/type. I know I can mark it as json then any in typescript but I'd like to know if it's possible to type something like this Do you have any ideas ? Thank you very much
export interface Offer {
id: string
originalPrice: string
discountedPrice: string
changes: Changes[]
}
interface AddVariantChange {
type: 'add_variant'
variantId: number
quantity: number
discount: Discount | null
}
export interface AddShippingLineChange {
type: 'add_shipping_line'
price: number
title?: string
presentmentTitle?: string
}
type Changes = AddVariantChange | AddShippingLineChange
5 replies