Return type from Prisma query

Hey Prisma ppl. I cannot find what is the Typescript type of a variable that returns findMany() For example, what in this case the variable source type would be? const sources = await prisma.source.findMany() Because, if I pass the variable source to other components, how to set the expected prop type to those components? currently, I'm doing something like this: sources: Awaited<ReturnType<typeof prisma.source.findMany>> But there gotta be a better way.
3 Replies
MackerDev
MackerDev•4mo ago
Try the #ask-ai channel. I had a similar query and got a helpful response.
Stefan Atanasov
Stefan AtanasovOP•4mo ago
It helped. Actually it just a simple import import { Source } from "@prisma/client"; I was trying to use Prisma.Source I'll just use the #ask-ai from now on, good tool. Thanks !
Nurul
Nurul•4mo ago
I am glad to hear that #ask-ai channel was useful 🙂
Want results from more Discord servers?
Add your server