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(types): change index "weights" to be more explicit #11997

Merged
merged 2 commits into from Jun 28, 2022

Conversation

hasezoey
Copy link
Collaborator

Summary

Currently the types for index option weights was defined as AnyObject which allows only string keys and any value type, but with this change string | number keys are allowed (i dont know if indexes support this, please review) and explicitly set the value type to number, because that is the only type mongodb accepts (from what i know)

Examples

sch.index({ field1: 1 }, { weights: { field1: 10 } });

types/indexes.d.ts Outdated Show resolved Hide resolved
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 AbdelrahmanHafez added the typescript Types or Types-test related issue / Pull Request label Jun 28, 2022
@AbdelrahmanHafez AbdelrahmanHafez added this to the 6.4.2 milestone Jun 28, 2022
@AbdelrahmanHafez AbdelrahmanHafez merged commit 16b17cc into Automattic:master Jun 28, 2022
@hasezoey hasezoey deleted the indexweights branch June 28, 2022 09:24
AbdelrahmanHafez added a commit that referenced this pull request Jun 28, 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