Skip to content

Conversation

vkarpov15
Copy link
Collaborator

Summary

#14573 points out that, if following Mongoose's docs on subdocuments in TypeScript, you end up with incorrect this param for methods. That's because you also need to set THydratedDocumentType on Schema<> as well as Model<> to get correct context for methods and middleware.

Examples

@vkarpov15 vkarpov15 added this to the 8.3.5 milestone May 7, 2024
@hasezoey hasezoey added docs This issue is due to a mistake or omission in the mongoosejs.com documentation typescript Types or Types-test related issue / Pull Request labels May 7, 2024
@vkarpov15 vkarpov15 merged commit d5202fb into master May 9, 2024
@hasezoey hasezoey deleted the vkarpov15/gh-14573 branch May 9, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation typescript Types or Types-test related issue / Pull Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants