79367393

Date: 2025-01-18 15:16:00
Score: 1.5
Natty:
Report link

I've been searching and came across this answer. It didn't work for me, maybe they updated syntax!!

What I used was just adding as followed by any of my existing table names, but please note this won't be good if the table names get changed. Also union types doesn't work, because typescript won't be able to narrow down the type and will throw another error!

You can still use as any like so:

await (prisma[tableName] as any).findUnique({..})
Reasons:
  • Blacklisted phrase (1): It didn't work for me
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Jimmy Mohamad