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
Do you want to request a feature or report a bug?
feature
What is the current behavior?
The projection parameter on methods such as findOne(), findById(), etc., is typed as any and doesn't narrow the return type
(This is just a typings QOL improvement request, not related to runtime behaviour)
If the current behavior is a bug, please provide the steps to reproduce.
I wouldn't say this is necessarily a bug, but here's an example of what I'm suggesting: https://gist.github.com/almeidx/74ede05cdebc1ba4a6fdfb0c03814eb9
This also includes a workaround that I have been using
What is the expected behavior?
I expected the projection parameter to be typed as the document's keys, and I would expect the return type to be narrowed down accordingly
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node v17.4.0
Mongoose v6.2.3
TypeScript 4.5.5
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
feature
What is the current behavior?
The
projection
parameter on methods such asfindOne()
,findById()
, etc., is typed asany
and doesn't narrow the return type(This is just a typings QOL improvement request, not related to runtime behaviour)
If the current behavior is a bug, please provide the steps to reproduce.
I wouldn't say this is necessarily a bug, but here's an example of what I'm suggesting:
https://gist.github.com/almeidx/74ede05cdebc1ba4a6fdfb0c03814eb9
This also includes a workaround that I have been using
What is the expected behavior?
I expected the
projection
parameter to be typed as the document's keys, and I would expect the return type to be narrowed down accordinglyWhat are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node v17.4.0
Mongoose v6.2.3
TypeScript 4.5.5
The text was updated successfully, but these errors were encountered: