Types are broken because of read replicas extension

I am exporting this singleton in my whole application
const prisma = new PrismaClient({
log: ['info', 'error', 'warn'],
}).$extends(
readReplicas({
url: databaseUrlReplicas,
}),
);

export { prisma };
const prisma = new PrismaClient({
log: ['info', 'error', 'warn'],
}).$extends(
readReplicas({
url: databaseUrlReplicas,
}),
);

export { prisma };
now I want to pass prisma as a type so that I pass transactions for example
await prisma.$transaction(async (prisma) => {
await prisma.gameDailyStreak.create({
data: {
userId,
gameId,
day: 1,
lastStreak: new Date(),
total: 1,
},
});
return await claimReward({ userId, gameId, day: 1, prisma });
});
await prisma.$transaction(async (prisma) => {
await prisma.gameDailyStreak.create({
data: {
userId,
gameId,
day: 1,
lastStreak: new Date(),
total: 1,
},
});
return await claimReward({ userId, gameId, day: 1, prisma });
});
in claimReward I used this
prisma: Prisma.TransactionClient;
prisma: Prisma.TransactionClient;
typescript will shout out me , once I remove the $.extends it works how do I grab the correct type
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server