Prisma JsonValue with TypeScript

So, we're having a problem in which we want to define a field in a modal that has some properties within it, but we DO NOT want it to be a relationship. The problem is that I haven't found any great way to properly type a JsonValue with prisma. Does anybody know a solution for this? Example:
model User {
id String
name String
age number
customInfo JsonValue
}

// the expected type for customInfo :
CustomInfo {
twitter String?
linkedin String?
}
model User {
id String
name String
age number
customInfo JsonValue
}

// the expected type for customInfo :
CustomInfo {
twitter String?
linkedin String?
}
This is just an example, but in our case, the "customInfo" CANNOT be inside the same model or another model
2 Replies
Quinn
Quinn8mo ago
I've been using https://github.com/arthurfiorette/prisma-json-types-generator, it sucks that Json typing is not built into Prisma itself but this will do the job, at least on the type level
deforestor
deforestor8mo ago
Wow thank you! I couldn't find anything