PrismaP
Prisma2y ago
3 replies
Stefan Atanasov

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.
Was this page helpful?