jquense / yup

Dead simple Object schema validation
MIT License
22.94k stars 935 forks source link

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

Open igo opened 6 months ago

igo commented 6 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.