Skip to content

types(model+query): avoid stripping out virtuals when calling populate with paths generic#15132

Merged
vkarpov15 merged 3 commits intomasterfrom
vkarpov15/gh-15111
Dec 30, 2024
Merged

types(model+query): avoid stripping out virtuals when calling populate with paths generic#15132
vkarpov15 merged 3 commits intomasterfrom
vkarpov15/gh-15111

Conversation

@vkarpov15
Copy link
Collaborator

Fix #15111

Summary

.populate<Paths> returns a hydrated document with no virtuals, because we're not passing TVirtuals into queries. This PR fixes that by replacing TInstanceMethods with TDocOverrides similar to what we do for HydratedDocument - globbing together instance methods and virtuals into one "overrides" type that we & on to get the fully hydrated document.

Examples

@vkarpov15 vkarpov15 added this to the 8.9.3 milestone Dec 26, 2024
@hasezoey hasezoey added the typescript Types or Types-test related issue / Pull Request label Dec 28, 2024
Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Some style changes to remove unrelated things from the types.

vkarpov15 and others added 2 commits December 30, 2024 15:08
Co-authored-by: hasezoey <hasezoey@gmail.com>
Co-authored-by: hasezoey <hasezoey@gmail.com>
@vkarpov15 vkarpov15 merged commit 8a0f581 into master Dec 30, 2024
5 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-15111 branch January 9, 2025 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

typescript Types or Types-test related issue / Pull Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

If I explicitly set the type of a PopulatedDoc variable using populate in a query, the virtual variables of the retrieved instances become nonexistent

3 participants