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

.map's ResultType must be an array if used over an array #10288

Merged
merged 1 commit into from
May 25, 2021

Conversation

quantumsheep
Copy link
Contributor

@quantumsheep quantumsheep commented May 25, 2021

Summary
When using .map(), I noticed that the return type wasn't right.

users.find().map((user) => user); // Query<UserDocument, UserDocument>

or it should be Query<UserDocument[], UserDocument>.

This PR fixes that issue while keeping non-array queries capable of using .map().

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.

Thanks 👍

@vkarpov15 vkarpov15 added this to the 5.12.12 milestone May 25, 2021
@vkarpov15 vkarpov15 added the typescript Types or Types-test related issue / Pull Request label May 25, 2021
@vkarpov15 vkarpov15 merged commit 4e4bd1a into Automattic:master May 25, 2021
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.

None yet

2 participants