P
Prisma6mo ago
Dexter

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>>
>
}
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>()({
export const UNIFIED_APPLICATION_PAYLOAD = Prisma.validator<Prisma.unified_applicationDefaultArgs>()({
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server