Closed felixmosh closed 1 year ago
const hostSchema = Joi.alternatives([Joi.string().ip(), Joi.string().domain().allow('localhost')]).required();
hostSchema gets a type of Joi.AlternativesSchema<any> instead of specific union of types,
Joi.AlternativesSchema<any>
It should contain reflect the union type of the alternatives...
Maybe we can use the types from https://github.com/maghis/types-joi/blob/master/index.d.ts which do work
The problem is that SchemaLike is not related to the TSchema, In addition, Typescript doesn't supports rest params of different types, therefore, we probably need to do what is done here
SchemaLike
TSchema
Support plan
Context
What are you trying to achieve or the steps to reproduce?
What was the result you got?
hostSchema gets a type of
Joi.AlternativesSchema<any>
instead of specific union of types,What result did you expect?
It should contain reflect the union type of the alternatives...
Maybe we can use the types from https://github.com/maghis/types-joi/blob/master/index.d.ts which do work
The problem is that
SchemaLike
is not related to theTSchema
, In addition, Typescript doesn't supports rest params of different types, therefore, we probably need to do what is done here