Skip to content
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

fix: Fixed incorrect type definition for Query's .map function #10544

Merged
merged 1 commit into from
Aug 8, 2021

Conversation

GCastilho
Copy link
Contributor

Summary

The type definition for the Query.map() function is incorrect. As an example, it does not understand that a Model.find() returns an array nor "pass the mapped value foward" in a correct way

Examples

Old:

Model.find().map(v => v) // v has type `DocType`

New:

Model.find().map(v => v) // v has type `DocType[]`

Old:

Trade.findOne().map(v => v._id).map(w => w) // w has type `DocType`

New:

Trade.findOne().map(v => v._id).map(w => w) // w has type `ObjectId`

@vkarpov15 vkarpov15 added this to the 5.13.6 milestone Aug 8, 2021
Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

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

Nice, thanks 👍

@vkarpov15 vkarpov15 merged commit cdc07ff into Automattic:master Aug 8, 2021
@GCastilho GCastilho deleted the type-map-fix branch August 9, 2021 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants