We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
object
const portSchema = Joi.number().integer().greater(2999).positive().required(); const hostSchema = Joi.alternatives([Joi.string().ip(), Joi.string().domain().allow('localhost')]).required(); const envSchema = Joi.object({ NODE_ENV: Joi.string().valid('production', 'development', 'test').required(), PORT: portSchema.default(3000).optional(), SERVICE_HOST: hostSchema, REDIS_PORT: portSchema, REDIS_HOST: hostSchema, });
envSchema gets a type of Joi.ObjectSchema<any> instead of specific object,
Joi.ObjectSchema<any>
It should contain reflect the object type...
Maybe we can use the types from https://github.com/maghis/types-joi/blob/master/index.d.ts which do work
I've managed to change types to reflect object's keys by modifying this
object<TSchema = any, isStrict = false, T = TSchema>(schema?: SchemaMap<T, isStrict>): ObjectSchema<TSchema>;
into
object<TSchema = any, isStrict = false>(schema?: SchemaMap<TSchema, isStrict>): ObjectSchema<TSchema>;
But it sets unknown to each key.
unknown
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Support plan
Context
What are you trying to achieve or the steps to reproduce?
What was the result you got?
envSchema gets a type of
Joi.ObjectSchema<any>
instead of specific object,What result did you expect?
It should contain reflect the object type...
Maybe we can use the types from https://github.com/maghis/types-joi/blob/master/index.d.ts which do work
I've managed to change types to reflect object's keys by modifying this
into
But it sets
unknown
to each key.The text was updated successfully, but these errors were encountered: