Hello guys this is my first time using TypeScript so I want to build an Auth controller class which takes in mongoose model in constructor and many others but the problem that I am facing I seem to not find the datatype / type for a mongoose model
When I hovered on top of the mongoose model I see the following: const model: Model<Document, {}>
- So I thought that
Modelis the type which I need to specify
This is how I tired to make this constructor
import { Model } from "mongoose";
class AuthController {
constructor(userModel: Model) {}
}
But I am getting this error message:
Generic type 'Model<T, QueryHelpers>' requires between 1 and 2 type arguments.tCan I please get some help on this I was trying to avoid using the any datatype because I want to make sure that the constructor takes in those specified parameter types
Model<User>where you have to define User.interface User { name: string; }