How do I solve this Joi problem(Using express, joi@17.4.2,joi-objectid@2.0.0, ,mongoose) I am trying to link two mongoose schemas using ref as
{
...
enroledcourses: [{
type: Schema.Types.ObjectId,
ref: "courses"
}]
}
joi validation
...
enroledcourses: Joi.array().items(Joi.ObjectId()).required()
the course collection is fine i have imported it at index.js as below
const Joi = require("joi")
Joi.objectId = require("joi-objectid")(Joi);
but i end up getting this error enter image description here
AssertionError [ERR_ASSERTION]: you must pass Joi as an argument at joiObjectId (D:\Programing projects\2021\ikodeafrika\ikodeafrikabackend\node_modules\joi-objectid\index.js:6:3) at Object. (D:\Programing projects\2021\ikodeafrika\ikodeafrikabackend\index.js:2:39)
index.js:2:39 being the joi.objectId import above plus i'm getting this when i hover over the joi.objectId import statement
Property 'objectId' may not exist on type 'Root'. Did you mean 'object'?ts(2568) index.d.ts(1998, 9): 'object' is declared here. any