Hello everyone, I am new to TypeScript and I am trying to create an Auth controller class that requires a mongoose model in the constructor. However, I am struggling to determine the datatype for the mongoose model.
When I checked the datatype for the mongoose model, it showed:
const model: Model<Document, {}>
- After analyzing this, I assumed that
Model
is the type that needs to be specified
This is how I attempted to define the constructor:
import { Model } from "mongoose";
class AuthController {
constructor(userModel: Model) {}
}
Unfortunately, I encountered this error message:
Generic type 'Model<T, QueryHelpers>' requires between 1 and 2 type arguments.t
I would appreciate some guidance on this issue as I tried to avoid using the any datatype to ensure that the constructor accepts only specific parameter types