Open Cheprer opened 2 months ago
For now workaround I figured could be to add .meta
e.g.:
export const JobSchema = Joi.object({
uptime: Joi.number().positive().allow(0).meta({ className: 'number' }),
}).meta({ className: 'Job' });
// results to
export interface Job {
uptime?: number | 0;
}
Allow is working almost the same as valid this should be fixed
Hi I'm having similar problem as described here: https://github.com/mrjono1/joi-to-typescript/issues/244 and that is according to this change https://github.com/mrjono1/joi-to-typescript/issues/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: https://github.com/mrjono1/joi-to-typescript/issues/206 this behaviour should only happen when I would specify
valid(0)
oronly(0)
.To Reproduce Steps to reproduce the behavior:
Expected behavior Generated type should be:
Actual behavior