jquense / yup

Dead simple Object schema validation
MIT License
22.72k stars 925 forks source link

Add support for async "is" function in "when" #2211

Open igo opened 4 months ago

igo commented 4 months ago

Add support for async is function so that async functions can be called inside.

.when(['$prisma'], {
    is: async (prisma: PrismaClient) => {
      return await prisma.entity.count({...});
    }
})

Right now seems that if there is an async it always evaluates to true.