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
interface JsonArray extends Array<JsonValue> {}

type JsonValue = string | number | boolean | JsonObject | JsonArray | null
interface JsonArray extends Array<JsonValue> {}

type JsonValue = string | number | boolean | JsonObject | JsonArray | null
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server