Adding allow(0) to number().positive() goes down to 0 instead of number #446
Open
Description
Hi I'm having similar problem as described here: #244 and that is according to this change #206 should be working differently.
As title says: Adding allow(0) to number().positive() goes down to 0 instead of number.
In general based on the issue: #206 this behaviour should only happen when I would specify valid(0)
or only(0)
.
To Reproduce
Steps to reproduce the behavior:
import Joi from "joi";
export const JobSchema = Joi.object({
uptime: Joi.number().positive().allow(0),
}).meta({ className: 'Job' });
Expected behavior
Generated type should be:
export interface Job {
uptime?: number | 0; // or it can be just number
}
Actual behavior
export interface Job {
uptime?: 0;
}