TCMiranda/joi-extract-type

Is it possible to infer nullable type?

Closed this issue · 1 comments

Hello, thank you for your project.
I was wondering if it's possible to infer nullable type.

const n = Joi.number().required().allow(null);
Joi.extractType<typeof n>; // expect number | null

Yes it is, actually .allow needs to be implemented for every schema.
It is not difficult, I just didn't have time to do it. Help is welcome 😁

See #5