You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We just updated to the latest Mongoose version 5.12.8 and got rid of the @types/mongoose. We had a couple of presave hooks which used an async function. This has worked fine so far (i.e. compiled via TypeScript and verified working at runtime).
If the current behavior is a bug, please provide the steps to reproduce.
Since using Mongoose’s typings, the following code produces an ESLint error:
// PRODUCES ESLINT ERROR:// Promise returned in function argument where a void return was expected.eslint// @typescript-eslint/no-misused-promisesmySchema.pre('save',asyncfunction(){// some async function returning a Promise});
What is the expected behavior?
I assume that it’s valid behavior to return a Promise (as stated, Mongoose handled this fine in the past). So the typings should include the case of returning a Promise<void> instead of void, so that the linting passes.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Mongoose 5.12.8
ESLint with plugin:promise/recommended
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
Bug?
What is the current behavior?
We just updated to the latest Mongoose version 5.12.8 and got rid of the
@types/mongoose
. We had a couple ofpre
save
hooks which used anasync
function. This has worked fine so far (i.e. compiled via TypeScript and verified working at runtime).If the current behavior is a bug, please provide the steps to reproduce.
Since using Mongoose’s typings, the following code produces an ESLint error:
What is the expected behavior?
I assume that it’s valid behavior to return a Promise (as stated, Mongoose handled this fine in the past). So the typings should include the case of returning a
Promise<void>
instead ofvoid
, so that the linting passes.What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
plugin:promise/recommended
The text was updated successfully, but these errors were encountered: