In my mongoose schema I use the following library like this: https://github.com/VassilisPallas/mongoose-fuzzy-searching
UserSchema.plugin(mongoose_fuzzy_searching, { fields: ['name'] });
And then in the service I use it like this:
export function fuzzySearchUser(name: string): Query<Array<IUser>>{
return User.fuzzySearch(name)
}
Now in the return line above get the following Typescript error:
Property 'fuzzySearch' does not exist on type 'Model<IUser, {}>'.ts(2339)
It doesn't help if I add it as a property with type function to the IUser interface and I cannot add it to the schema either.
(interface IUser extends mongoose.Document)