Open lonewarrior556 opened 3 years ago
simple example
import Joi from '@hapi/joi'; import 'joi-extract-type'; var schema = Joi.object({ one: Joi.array().items({ a: Joi.string().required() }), two: Joi.array().items({ a: Joi.string().required() }).allow(null), }); type Extracted = Joi.extractType<typeof schema>;
packages
"@hapi/joi": "15.1.1", "joi-extract-type": "15.0.8", "@types/hapi__joi": "15.0.4",
Also, when writing Joi code like this Joi.array().items(Joi.string()).required().allow(null), it infers (string | null)[] but I think it would be string[] | null.
Joi.array().items(Joi.string()).required().allow(null)
(string | null)[]
string[] | null
simple example
packages