Arrays always interpreted as optional when inside an object
Closed this issue · 0 comments
gustavopch commented
As the title says, Joi.array()
is always thought to be optional when inside an object.
import * as Joi from 'joi'
import 'joi-extract-type'
const schema = Joi.object({
channels: Joi.array().items(Joi.string()).required()
})
type Schema = Joi.extractType<typeof schema>
// Result:
// type Schema = {
// channels?: string[] | undefined
// }