-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Return type of document.depopulate()
is still the populated document type
#14876
Closed
2 tasks done
Labels
typescript
Types or Types-test related issue / Pull Request
Milestone
Comments
vkarpov15
added a commit
that referenced
this issue
Sep 17, 2024
types(document): add generic param to depopulate() to allow updating properties
With #14891 you'll be able to do |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Mongoose version
8.6.1
Node.js version
18.19.0
MongoDB server version
6.0.15 Community
Typescript version (if applicable)
5.6.2
Description
When populating a document, and then depopulating it, the type will remain as if the document is still populated.
When testing in 8.3.1, the return type from a
depopulate()
method is the original document type.Steps to Reproduce
Expected Behavior
The return value from
.depopulate()
method should be the depopulated type.In the case of the reproduction script,
is expected to give a type error, because
owner
type is expected to beObjectId
The text was updated successfully, but these errors were encountered: