How to type storing JSON in Postgres with Prisma
I am storing a json array in postgres for a specific use case, and prisma types it is as
Prisma.JsonValue
. However, I know what the shape of this json will be. In their docs they recommend doing this (light mode screenshot).
The issue is that Prisma.JsonArray is just a type saying its an array of other json stuff. How can I make it an array of an actual type I know? Ideally as Link[]
would be good but I have to do as unknown as Link[]
for that to work and it does not feel correct. Any ideas? Thanks


0 Replies