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: missing typescript details on options params of updateMany, updateOne, etc. #14382

Merged
merged 3 commits into from Feb 26, 2024

Conversation

FaizBShah
Copy link
Contributor

@FaizBShah FaizBShah commented Feb 26, 2024

Fixes #14378

Summary
Fixes the missing typescript details from the options parameter of functions like updateMany(), updateOne(), etc. The issue happened because the Omit in Omit<MongooseQueryOptions<TRawDocType>, 'lean'> was making the type of the keys vague because MongooseQueryOptions contains [other: string]: any. To fix this, introdduced a new TS Util function called ExcludeKeys which fixes this logic without weakening the type

Examples
The property timestamps and other such params are now visible
Screenshot 2024-02-26 190616

Its still supporting arbitrary options like fallback without any type issues
Screenshot 2024-02-26 190710

@sderrow
Copy link
Contributor

sderrow commented Feb 26, 2024

Can't formally review, but LGTM!

@vkarpov15 vkarpov15 merged commit 28855e1 into Automattic:master Feb 26, 2024
3 checks passed
@vkarpov15 vkarpov15 added this to the 8.2.1 milestone Feb 26, 2024
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.

Missing Typescript detail on Mongoose-specific options for updateOne, updateMany, etc.
3 participants