-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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 does not complain about type issues when returning doc.toObject()
#12883
Comments
The issue is that while you define |
Thanks for your help, but this is not what my issue is about. My issue is about TypeScript not complaining in the 2nd case. |
types: make toObject() and toJSON() not generic by default to avoid type widening
Prerequisites
Mongoose version
6.8.3
Node.js version
n/a
MongoDB server version
n/a
Typescript version (if applicable)
4.9.4
Description
I am having a hard time understanding why TypeScript complains in
getUser_1
andgetUser_3
seen below, but not ingetUser_2
.Is this an issue with mongoose?
Steps to Reproduce
Expected Behavior
TypeScript should complain in
getUser_2
, too.The text was updated successfully, but these errors were encountered: