I encountered an issue when attempting to integrate mongoose passport into my schema, resulting in the following error message:
export interface IUserModel extends IUser, Document { };
export let userSchema = new Schema({
username: { type: String, required: true, unique: true }
}
firstName: { type: String, required: true },
const passportLocalMongoose = require("passport-local-mongoose");
userSchema.plugin(passportLocalMongoose);
export let User: Model<IUserModel> = model<IUserModel>("User", userSchema);
My steps included adding the following to app.ts (main file):
import { User } from "./schemas/user";
let passport = require("passport");
passport.use(new localstrategy(User.authenticate()));
However, this led to the error message:
error TS2339: Property authenticate
does not exist on type Model<IUserModel>
If you have a solution to this problem, please kindly share it. Thank you.