@pre<User>('save', async function () {
this.password = await Password.hash(this.password);
})
export class User {
@prop()
name!: string;
@prop()
password!: string;
}
Gives the following error:
Promise returned in function argument where a void return was expected.eslint(@typescript-eslint/no-misused-promises)
Is there a way to fix this? or it needs to be changed in the TypeScript typings?
https://github.com/typegoose/typegoose/blob/26afc6933e834b42a6ac02920658a240c6eda18a/src/hooks.ts#L14
+ type PreFnWithDocumentType<T> = (this: DocumentType<T>, next: HookNextErrorFn) => void | Promise<void>;
- type PreFnWithDocumentType<T> = (this: DocumentType<T>, next: HookNextErrorFn) => void;
this definitely seems wrong, but i cant replicate it, could you provide an reproduction repo?
Yes, sure.
https://github.com/kerolloz/typegoose-bug
Make sure ESLint is working in VSCode.

oh right forgot that, my project(s) dont use eslint (yet), so i couldnt reproduce it
will fix it
Thank you @hasezoey :heart_eyes:
will be included in 7.4.1
That's great! Thanks :sparkles: