PrismaP
Prisma2y ago
1 reply
omgwot

Is there any way to avoid this cast?

  public forProject<T extends Prisma.unified_applicationDefaultArgs>(
    projectId: string,
    payload?: T,
    txn: Prisma.TransactionClient = this.prisma
  ) {
    return txn.unified_application.findMany({ where: { projectId, ...payload } }) as Promise<
      Array<Prisma.unified_applicationGetPayload<T>>
    >
  }


I specifically want to avoid the as Promise<Array<Prisma.unified_applicationGetPayload<T>>> cast. Basically I want the caller to be able to pass in any argument they want. I'm creating the arguments by:

export const UNIFIED_APPLICATION_PAYLOAD = Prisma.validator<Prisma.unified_applicationDefaultArgs>()({
Was this page helpful?