narrow down String type using prisma client's extension?

can I explain to prisma client and typescript that this particular field needs to be a string union?
model Lesson {
id Int @id @default(autoincrement())
type String? // null | "practical" | "seminar" | "lecture"
model Lesson {
id Int @id @default(autoincrement())
type String? // null | "practical" | "seminar" | "lecture"
2 Replies
piscopancer
piscopancerOP2mo ago
ofc there are no unions on the DB level, I just want editor-level unions
RaphaelEtim
RaphaelEtim2mo ago
Prisma does not have built-in support for defining string union types directly in the schema. You could consider using an enum
enum LessonType {
practical
seminar
lecture

}

model Lesson {
id Int @id @default(autoincrement())
type LessonType?
}
enum LessonType {
practical
seminar
lecture

}

model Lesson {
id Int @id @default(autoincrement())
type LessonType?
}
Want results from more Discord servers?
Add your server