Heyo, I'm using Prisma for an already existing pro...
# orm-help
a
Heyo, I'm using Prisma for an already existing project in which I store a lot of data as structured json. Is there anyway to get type support for the entries inside of the json or will I have to type it all out myself? Also, how can I avoid getting errors such as
Property 'id' does not exist on type 'JsonValue'.
Copy code
model Guild {
  id     String  @id
  prefix String?
  locale String?
  tags   Json[]
}
🍿 2
r
🍿 = i'm watching this thread, as i'm interested in the answer. One question, though:
Is there anyway to get type support for the entries inside of the json
do you want type support inside prisma's scope, or in your JS after you have back your
Guild
from a
const Guild = prisma.Guild.findMany({x})
a
Ideally there should be type support for when you're performing a CRUD action and for when you get back the
Guild
So:
Copy code
const { tags } = await prisma.guild.findFirst({...})

// "tag.id" would throw an error
tags.find((tag) => tag.id === 'foo');
There's an open issue on github (https://github.com/prisma/prisma/issues/3219) for this but I wanted to ask here to see if there's any good fixes that aren't tacky