-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
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
Typescript issues. #304
Comments
@Jewcub check this link I was facing same error and resolved it using the above link. |
same problem as #229 , |
Solved: import { Document, PassportLocalDocument, PassportLocalModel, PassportLocalSchema } from "mongoose";
interface User extends PassportLocalDocument {
username: string;
password: string;
}
const UserSchema = new Schema(
{
username: String,
password: String,
}) as PassportLocalSchema;
interface UserModel <T extends Document> extends PassportLocalModel<T> {}
UserSchema.plugin(passportLocalMongoose);
const UserModel: UserModel<User> = mongoose.model<User>("user", UserSchema); This should give you all the passport local methods like .registered() on usermodel |
Same problems, very confusing and annoying 😕 |
4 years and this is still not in README 👀 |
I'm also experiencing the typescript issues mentioned below. I tried npm installing all the @types/ but that didn't help.
I still have this issue with typescript, doesn't compile because register is not a member of the User model.
any ideas?
The strange this is when I run your project it works but when I import the same code in my project it doesn't work - I'm new to typescript so not sure of what's the usual steps to undertake when this sort of collision occurs.
Originally posted by @hajjboy95 in #229 (comment)
The text was updated successfully, but these errors were encountered: