#What to cast the incoming data as in typescript?

5 messages · Page 1 of 1 (latest)

amber lichen
#

I've been using this ORM for months now but I still feel like I'm doing it a hacky way. Usually I just make a separate type clone of the prisma schema file but i feel like that's a violation of DRY.
Can I use the Prisma.X types like this somehow, especially when there are include being used? I can't find any in the definitions file for how you'd get the included relations in the type.
Like this: const data = req.body as WebDataRequestBody<BankAccount>; won't include owners, but if i use Prisma.BankAccountUpdateInput then it will cast owners to something completely different with functions, making the insertion impossible.
Thanks.

brazen oriole
amber lichen
brazen oriole
#

Thanks for the feedback.
I assume it was difficult to find this section of docs because of it's title?

amber lichen