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

[Types] Re-add the possibility to pass undefined for projection in Model.find #11965

Merged
merged 2 commits into from Jun 21, 2022

Conversation

ghost91-
Copy link
Contributor

Summary

This re-adds the possibility to pass undefined as projection to the find method of models.

Examples

  Project.find({}, undefined, { limit: 5 });

(see the added tests for more details)

@ghost91- ghost91- changed the title Re-add the possibility to pass undefined for projection in Model.find [Types] Re-add the possibility to pass undefined for projection in Model.find Jun 21, 2022
@AbdelrahmanHafez AbdelrahmanHafez added the typescript Types or Types-test related issue / Pull Request label Jun 21, 2022
@AbdelrahmanHafez AbdelrahmanHafez added this to the 6.4.1 milestone Jun 21, 2022
Copy link
Collaborator

@AbdelrahmanHafez AbdelrahmanHafez left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! 👍

@AbdelrahmanHafez
Copy link
Collaborator

@ghost91-
Should we also do the same for .findOne/findOneAndUpdate/findById?

@ghost91-
Copy link
Contributor Author

ghost91- commented Jun 21, 2022

For those, it's already done, if I am not mistaken. undefined is not listed explicitly, but the parameters marked optional. Unless you are using the exactOptionalPropertyTypes option, it results in the same thing. I just tend to specify undefined explicitly because I sometimes use that option.

Granted, there also are no tests for the other methods, so it may be worth adding some.

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 merged commit 63ea65e into Automattic:master Jun 21, 2022
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

3 participants